Move Images code to hsa-runtime folder
Change-Id: I53c1845d985ac3e9708d952865009c0021f3bb4f
[ROCm/ROCR-Runtime commit: 7e3db20826]
Dieser Commit ist enthalten in:
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright © 2017-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
#ifndef _AMDGPU_ASIC_ADDR_H
|
||||
#define _AMDGPU_ASIC_ADDR_H
|
||||
|
||||
#define ATI_VENDOR_ID 0x1002
|
||||
#define AMD_VENDOR_ID 0x1022
|
||||
|
||||
// AMDGPU_VENDOR_IS_AMD(vendorId)
|
||||
#define AMDGPU_VENDOR_IS_AMD(v) ((v == ATI_VENDOR_ID) || (v == AMD_VENDOR_ID))
|
||||
|
||||
#define FAMILY_UNKNOWN 0x00
|
||||
#define FAMILY_TN 0x69
|
||||
#define FAMILY_SI 0x6E
|
||||
#define FAMILY_CI 0x78
|
||||
#define FAMILY_KV 0x7D
|
||||
#define FAMILY_VI 0x82
|
||||
#define FAMILY_POLARIS 0x82
|
||||
#define FAMILY_CZ 0x87
|
||||
#define FAMILY_AI 0x8D
|
||||
#define FAMILY_RV 0x8E
|
||||
#define FAMILY_NV 0x8F
|
||||
|
||||
// AMDGPU_FAMILY_IS(familyId, familyName)
|
||||
#define FAMILY_IS(f, fn) (f == FAMILY_##fn)
|
||||
#define FAMILY_IS_TN(f) FAMILY_IS(f, TN)
|
||||
#define FAMILY_IS_SI(f) FAMILY_IS(f, SI)
|
||||
#define FAMILY_IS_CI(f) FAMILY_IS(f, CI)
|
||||
#define FAMILY_IS_KV(f) FAMILY_IS(f, KV)
|
||||
#define FAMILY_IS_VI(f) FAMILY_IS(f, VI)
|
||||
#define FAMILY_IS_POLARIS(f) FAMILY_IS(f, POLARIS)
|
||||
#define FAMILY_IS_CZ(f) FAMILY_IS(f, CZ)
|
||||
#define FAMILY_IS_AI(f) FAMILY_IS(f, AI)
|
||||
#define FAMILY_IS_RV(f) FAMILY_IS(f, RV)
|
||||
#define FAMILY_IS_NV(f) FAMILY_IS(f, NV)
|
||||
|
||||
#define AMDGPU_UNKNOWN 0xFF
|
||||
|
||||
#define AMDGPU_TAHITI_RANGE 0x05, 0x14
|
||||
#define AMDGPU_PITCAIRN_RANGE 0x15, 0x28
|
||||
#define AMDGPU_CAPEVERDE_RANGE 0x29, 0x3C
|
||||
#define AMDGPU_OLAND_RANGE 0x3C, 0x46
|
||||
#define AMDGPU_HAINAN_RANGE 0x46, 0xFF
|
||||
|
||||
#define AMDGPU_BONAIRE_RANGE 0x14, 0x28
|
||||
#define AMDGPU_HAWAII_RANGE 0x28, 0x3C
|
||||
|
||||
#define AMDGPU_SPECTRE_RANGE 0x01, 0x41
|
||||
#define AMDGPU_SPOOKY_RANGE 0x41, 0x81
|
||||
#define AMDGPU_KALINDI_RANGE 0x81, 0xA1
|
||||
#define AMDGPU_GODAVARI_RANGE 0xA1, 0xFF
|
||||
|
||||
#define AMDGPU_ICELAND_RANGE 0x01, 0x14
|
||||
#define AMDGPU_TONGA_RANGE 0x14, 0x28
|
||||
#define AMDGPU_FIJI_RANGE 0x3C, 0x50
|
||||
#define AMDGPU_POLARIS10_RANGE 0x50, 0x5A
|
||||
#define AMDGPU_POLARIS11_RANGE 0x5A, 0x64
|
||||
#define AMDGPU_POLARIS12_RANGE 0x64, 0x6E
|
||||
#define AMDGPU_VEGAM_RANGE 0x6E, 0xFF
|
||||
|
||||
#define AMDGPU_CARRIZO_RANGE 0x01, 0x21
|
||||
#define AMDGPU_STONEY_RANGE 0x61, 0xFF
|
||||
|
||||
#define AMDGPU_VEGA10_RANGE 0x01, 0x14
|
||||
#define AMDGPU_VEGA12_RANGE 0x14, 0x28
|
||||
#define AMDGPU_VEGA20_RANGE 0x28, 0x32
|
||||
#define AMDGPU_ARCTURUS_RANGE 0x32, 0xFF
|
||||
|
||||
#define AMDGPU_RAVEN_RANGE 0x01, 0x81
|
||||
#define AMDGPU_RAVEN2_RANGE 0x81, 0x91
|
||||
#define AMDGPU_RENOIR_RANGE 0x91, 0xFF
|
||||
|
||||
#define AMDGPU_NAVI10_RANGE 0x01, 0x0A
|
||||
#define AMDGPU_NAVI12_RANGE 0x0A, 0x14
|
||||
#define AMDGPU_NAVI14_RANGE 0x14, 0x28
|
||||
|
||||
#define AMDGPU_EXPAND_FIX(x) x
|
||||
#define AMDGPU_RANGE_HELPER(val, min, max) ((val >= min) && (val < max))
|
||||
#define AMDGPU_IN_RANGE(val, ...) AMDGPU_EXPAND_FIX(AMDGPU_RANGE_HELPER(val, __VA_ARGS__))
|
||||
|
||||
// ASICREV_IS(eRevisionId, revisionName)
|
||||
#define ASICREV_IS(r, rn) AMDGPU_IN_RANGE(r, AMDGPU_##rn##_RANGE)
|
||||
#define ASICREV_IS_TAHITI_P(r) ASICREV_IS(r, TAHITI)
|
||||
#define ASICREV_IS_PITCAIRN_PM(r) ASICREV_IS(r, PITCAIRN)
|
||||
#define ASICREV_IS_CAPEVERDE_M(r) ASICREV_IS(r, CAPEVERDE)
|
||||
#define ASICREV_IS_OLAND_M(r) ASICREV_IS(r, OLAND)
|
||||
#define ASICREV_IS_HAINAN_V(r) ASICREV_IS(r, HAINAN)
|
||||
|
||||
#define ASICREV_IS_BONAIRE_M(r) ASICREV_IS(r, BONAIRE)
|
||||
#define ASICREV_IS_HAWAII_P(r) ASICREV_IS(r, HAWAII)
|
||||
|
||||
#define ASICREV_IS_SPECTRE(r) ASICREV_IS(r, SPECTRE)
|
||||
#define ASICREV_IS_SPOOKY(r) ASICREV_IS(r, SPOOKY)
|
||||
#define ASICREV_IS_KALINDI(r) ASICREV_IS(r, KALINDI)
|
||||
#define ASICREV_IS_KALINDI_GODAVARI(r) ASICREV_IS(r, GODAVARI)
|
||||
|
||||
#define ASICREV_IS_ICELAND_M(r) ASICREV_IS(r, ICELAND)
|
||||
#define ASICREV_IS_TONGA_P(r) ASICREV_IS(r, TONGA)
|
||||
#define ASICREV_IS_FIJI_P(r) ASICREV_IS(r, FIJI)
|
||||
|
||||
#define ASICREV_IS_POLARIS10_P(r) ASICREV_IS(r, POLARIS10)
|
||||
#define ASICREV_IS_POLARIS11_M(r) ASICREV_IS(r, POLARIS11)
|
||||
#define ASICREV_IS_POLARIS12_V(r) ASICREV_IS(r, POLARIS12)
|
||||
#define ASICREV_IS_VEGAM_P(r) ASICREV_IS(r, VEGAM)
|
||||
|
||||
#define ASICREV_IS_CARRIZO(r) ASICREV_IS(r, CARRIZO)
|
||||
#define ASICREV_IS_STONEY(r) ASICREV_IS(r, STONEY)
|
||||
|
||||
#define ASICREV_IS_VEGA10_M(r) ASICREV_IS(r, VEGA10)
|
||||
#define ASICREV_IS_VEGA10_P(r) ASICREV_IS(r, VEGA10)
|
||||
#define ASICREV_IS_VEGA12_P(r) ASICREV_IS(r, VEGA12)
|
||||
#define ASICREV_IS_VEGA12_p(r) ASICREV_IS(r, VEGA12)
|
||||
#define ASICREV_IS_VEGA20_P(r) ASICREV_IS(r, VEGA20)
|
||||
#define ASICREV_IS_ARCTURUS(r) ASICREV_IS(r, ARCTURUS)
|
||||
|
||||
#define ASICREV_IS_RAVEN(r) ASICREV_IS(r, RAVEN)
|
||||
#define ASICREV_IS_RAVEN2(r) ASICREV_IS(r, RAVEN2)
|
||||
#define ASICREV_IS_RENOIR(r) ASICREV_IS(r, RENOIR)
|
||||
|
||||
#define ASICREV_IS_NAVI10_P(r) ASICREV_IS(r, NAVI10)
|
||||
#define ASICREV_IS_NAVI12(r) ASICREV_IS(r, NAVI12)
|
||||
#define ASICREV_IS_NAVI14(r) ASICREV_IS(r, NAVI14)
|
||||
|
||||
#endif // _AMDGPU_ASIC_ADDR_H
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
#if !defined (__GFX10_GB_REG_H__)
|
||||
#define __GFX10_GB_REG_H__
|
||||
|
||||
/*
|
||||
* gfx10_gb_reg.h
|
||||
*
|
||||
* Register Spec Release: 1.0
|
||||
*
|
||||
*/
|
||||
|
||||
union GB_ADDR_CONFIG
|
||||
{
|
||||
struct
|
||||
{
|
||||
#if defined(LITTLEENDIAN_CPU)
|
||||
unsigned int NUM_PIPES : 3;
|
||||
unsigned int PIPE_INTERLEAVE_SIZE : 3;
|
||||
unsigned int MAX_COMPRESSED_FRAGS : 2;
|
||||
unsigned int NUM_PKRS : 3;
|
||||
unsigned int : 21;
|
||||
#elif defined(BIGENDIAN_CPU)
|
||||
unsigned int : 21;
|
||||
unsigned int NUM_PKRS : 3;
|
||||
unsigned int MAX_COMPRESSED_FRAGS : 2;
|
||||
unsigned int PIPE_INTERLEAVE_SIZE : 3;
|
||||
unsigned int NUM_PIPES : 3;
|
||||
#endif
|
||||
} bitfields, bits;
|
||||
unsigned int u32All;
|
||||
int i32All;
|
||||
float f32All;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
#if !defined (__GFX9_GB_REG_H__)
|
||||
#define __GFX9_GB_REG_H__
|
||||
|
||||
/*
|
||||
* gfx9_gb_reg.h
|
||||
*
|
||||
* Register Spec Release: 1.0
|
||||
*
|
||||
*/
|
||||
|
||||
union GB_ADDR_CONFIG {
|
||||
struct {
|
||||
#if defined(LITTLEENDIAN_CPU)
|
||||
unsigned int NUM_PIPES : 3;
|
||||
unsigned int PIPE_INTERLEAVE_SIZE : 3;
|
||||
unsigned int MAX_COMPRESSED_FRAGS : 2;
|
||||
unsigned int BANK_INTERLEAVE_SIZE : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int NUM_BANKS : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int SHADER_ENGINE_TILE_SIZE : 3;
|
||||
unsigned int NUM_SHADER_ENGINES : 2;
|
||||
unsigned int NUM_GPUS : 3;
|
||||
unsigned int MULTI_GPU_TILE_SIZE : 2;
|
||||
unsigned int NUM_RB_PER_SE : 2;
|
||||
unsigned int ROW_SIZE : 2;
|
||||
unsigned int NUM_LOWER_PIPES : 1;
|
||||
unsigned int SE_ENABLE : 1;
|
||||
#elif defined(BIGENDIAN_CPU)
|
||||
unsigned int SE_ENABLE : 1;
|
||||
unsigned int NUM_LOWER_PIPES : 1;
|
||||
unsigned int ROW_SIZE : 2;
|
||||
unsigned int NUM_RB_PER_SE : 2;
|
||||
unsigned int MULTI_GPU_TILE_SIZE : 2;
|
||||
unsigned int NUM_GPUS : 3;
|
||||
unsigned int NUM_SHADER_ENGINES : 2;
|
||||
unsigned int SHADER_ENGINE_TILE_SIZE : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int NUM_BANKS : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int BANK_INTERLEAVE_SIZE : 3;
|
||||
unsigned int MAX_COMPRESSED_FRAGS : 2;
|
||||
unsigned int PIPE_INTERLEAVE_SIZE : 3;
|
||||
unsigned int NUM_PIPES : 3;
|
||||
#endif
|
||||
} bitfields, bits;
|
||||
unsigned int u32All;
|
||||
signed int i32All;
|
||||
float f32All;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
#if !defined (__SI_GB_REG_H__)
|
||||
#define __SI_GB_REG_H__
|
||||
|
||||
/*****************************************************************************************************************
|
||||
*
|
||||
* si_gb_reg.h
|
||||
*
|
||||
* Register Spec Release: Chip Spec 0.28
|
||||
*
|
||||
*****************************************************************************************************************/
|
||||
|
||||
/*
|
||||
* GB_ADDR_CONFIG struct
|
||||
*/
|
||||
|
||||
#if defined(LITTLEENDIAN_CPU)
|
||||
|
||||
typedef struct _GB_ADDR_CONFIG_T {
|
||||
unsigned int num_pipes : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int pipe_interleave_size : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int bank_interleave_size : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int num_shader_engines : 2;
|
||||
unsigned int : 2;
|
||||
unsigned int shader_engine_tile_size : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int num_gpus : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int multi_gpu_tile_size : 2;
|
||||
unsigned int : 2;
|
||||
unsigned int row_size : 2;
|
||||
unsigned int num_lower_pipes : 1;
|
||||
unsigned int : 1;
|
||||
} GB_ADDR_CONFIG_T;
|
||||
|
||||
#elif defined(BIGENDIAN_CPU)
|
||||
|
||||
typedef struct _GB_ADDR_CONFIG_T {
|
||||
unsigned int : 1;
|
||||
unsigned int num_lower_pipes : 1;
|
||||
unsigned int row_size : 2;
|
||||
unsigned int : 2;
|
||||
unsigned int multi_gpu_tile_size : 2;
|
||||
unsigned int : 1;
|
||||
unsigned int num_gpus : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int shader_engine_tile_size : 3;
|
||||
unsigned int : 2;
|
||||
unsigned int num_shader_engines : 2;
|
||||
unsigned int : 1;
|
||||
unsigned int bank_interleave_size : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int pipe_interleave_size : 3;
|
||||
unsigned int : 1;
|
||||
unsigned int num_pipes : 3;
|
||||
} GB_ADDR_CONFIG_T;
|
||||
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
unsigned int val : 32;
|
||||
GB_ADDR_CONFIG_T f;
|
||||
} GB_ADDR_CONFIG;
|
||||
|
||||
#if defined(LITTLEENDIAN_CPU)
|
||||
|
||||
typedef struct _GB_TILE_MODE_T {
|
||||
unsigned int micro_tile_mode : 2;
|
||||
unsigned int array_mode : 4;
|
||||
unsigned int pipe_config : 5;
|
||||
unsigned int tile_split : 3;
|
||||
unsigned int bank_width : 2;
|
||||
unsigned int bank_height : 2;
|
||||
unsigned int macro_tile_aspect : 2;
|
||||
unsigned int num_banks : 2;
|
||||
unsigned int micro_tile_mode_new : 3;
|
||||
unsigned int sample_split : 2;
|
||||
unsigned int : 5;
|
||||
} GB_TILE_MODE_T;
|
||||
|
||||
typedef struct _GB_MACROTILE_MODE_T {
|
||||
unsigned int bank_width : 2;
|
||||
unsigned int bank_height : 2;
|
||||
unsigned int macro_tile_aspect : 2;
|
||||
unsigned int num_banks : 2;
|
||||
unsigned int : 24;
|
||||
} GB_MACROTILE_MODE_T;
|
||||
|
||||
#elif defined(BIGENDIAN_CPU)
|
||||
|
||||
typedef struct _GB_TILE_MODE_T {
|
||||
unsigned int : 5;
|
||||
unsigned int sample_split : 2;
|
||||
unsigned int micro_tile_mode_new : 3;
|
||||
unsigned int num_banks : 2;
|
||||
unsigned int macro_tile_aspect : 2;
|
||||
unsigned int bank_height : 2;
|
||||
unsigned int bank_width : 2;
|
||||
unsigned int tile_split : 3;
|
||||
unsigned int pipe_config : 5;
|
||||
unsigned int array_mode : 4;
|
||||
unsigned int micro_tile_mode : 2;
|
||||
} GB_TILE_MODE_T;
|
||||
|
||||
typedef struct _GB_MACROTILE_MODE_T {
|
||||
unsigned int : 24;
|
||||
unsigned int num_banks : 2;
|
||||
unsigned int macro_tile_aspect : 2;
|
||||
unsigned int bank_height : 2;
|
||||
unsigned int bank_width : 2;
|
||||
} GB_MACROTILE_MODE_T;
|
||||
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
unsigned int val : 32;
|
||||
GB_TILE_MODE_T f;
|
||||
} GB_TILE_MODE;
|
||||
|
||||
typedef union {
|
||||
unsigned int val : 32;
|
||||
GB_MACROTILE_MODE_T f;
|
||||
} GB_MACROTILE_MODE;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,948 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrcommon.h
|
||||
* @brief Contains the helper function and constants.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ADDR_COMMON_H__
|
||||
#define __ADDR_COMMON_H__
|
||||
|
||||
#include "addrinterface.h"
|
||||
|
||||
#if !defined(DEBUG)
|
||||
#ifdef NDEBUG
|
||||
#define DEBUG 0
|
||||
#else
|
||||
#define DEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ADDR_LNX_KERNEL_BUILD is for internal build
|
||||
// Moved from addrinterface.h so __KERNEL__ is not needed any more
|
||||
#if ADDR_LNX_KERNEL_BUILD // || (defined(__GNUC__) && defined(__KERNEL__))
|
||||
#include <string.h>
|
||||
#elif !defined(__APPLE__) || defined(HAVE_TSERVER)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include "util/macros.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Platform specific debug break defines
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if DEBUG
|
||||
#if defined(__GNUC__)
|
||||
#define ADDR_DBG_BREAK() assert(false)
|
||||
#elif defined(__APPLE__)
|
||||
#define ADDR_DBG_BREAK() { IOPanic("");}
|
||||
#else
|
||||
#define ADDR_DBG_BREAK() { __debugbreak(); }
|
||||
#endif
|
||||
#else
|
||||
#define ADDR_DBG_BREAK() do {} while(0)
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Debug assertions used in AddrLib
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(_WIN32) && (_MSC_VER >= 1400)
|
||||
#define ADDR_ANALYSIS_ASSUME(expr) __analysis_assume(expr)
|
||||
#else
|
||||
#define ADDR_ANALYSIS_ASSUME(expr) do { (void)(expr); } while (0)
|
||||
#endif
|
||||
|
||||
#define ADDR_ASSERT(__e) assert(__e)
|
||||
#define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK()
|
||||
#define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case")
|
||||
#define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented");
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Debug print macro from legacy address library
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if DEBUG
|
||||
|
||||
#define ADDR_PRNT(a) Object::DebugPrint a
|
||||
|
||||
/// @brief Macro for reporting informational messages
|
||||
/// @ingroup util
|
||||
///
|
||||
/// This macro optionally prints an informational message to stdout.
|
||||
/// The first parameter is a condition -- if it is true, nothing is done.
|
||||
/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
|
||||
/// starting with a string. This is passed to printf() or an equivalent
|
||||
/// in order to format the informational message. For example,
|
||||
/// ADDR_INFO(0, ("test %d",3) ); prints out "test 3".
|
||||
///
|
||||
#define ADDR_INFO(cond, a) \
|
||||
{ if (!(cond)) { ADDR_PRNT(a); } }
|
||||
|
||||
/// @brief Macro for reporting error warning messages
|
||||
/// @ingroup util
|
||||
///
|
||||
/// This macro optionally prints an error warning message to stdout,
|
||||
/// followed by the file name and line number where the macro was called.
|
||||
/// The first parameter is a condition -- if it is true, nothing is done.
|
||||
/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
|
||||
/// starting with a string. This is passed to printf() or an equivalent
|
||||
/// in order to format the informational message. For example,
|
||||
/// ADDR_WARN(0, ("test %d",3) ); prints out "test 3" followed by
|
||||
/// a second line with the file name and line number.
|
||||
///
|
||||
#define ADDR_WARN(cond, a) \
|
||||
{ if (!(cond)) \
|
||||
{ ADDR_PRNT(a); \
|
||||
ADDR_PRNT((" WARNING in file %s, line %d\n", __FILE__, __LINE__)); \
|
||||
} }
|
||||
|
||||
/// @brief Macro for reporting fatal error conditions
|
||||
/// @ingroup util
|
||||
///
|
||||
/// This macro optionally stops execution of the current routine
|
||||
/// after printing an error warning message to stdout,
|
||||
/// followed by the file name and line number where the macro was called.
|
||||
/// The first parameter is a condition -- if it is true, nothing is done.
|
||||
/// The second pararmeter MUST be a parenthesis-enclosed list of arguments,
|
||||
/// starting with a string. This is passed to printf() or an equivalent
|
||||
/// in order to format the informational message. For example,
|
||||
/// ADDR_EXIT(0, ("test %d",3) ); prints out "test 3" followed by
|
||||
/// a second line with the file name and line number, then stops execution.
|
||||
///
|
||||
#define ADDR_EXIT(cond, a) \
|
||||
{ if (!(cond)) \
|
||||
{ ADDR_PRNT(a); ADDR_DBG_BREAK();\
|
||||
} }
|
||||
|
||||
#else // DEBUG
|
||||
|
||||
#define ADDRDPF 1 ? (void)0 : (void)
|
||||
|
||||
#define ADDR_PRNT(a) do {} while(0)
|
||||
|
||||
#define ADDR_DBG_BREAK() do {} while(0)
|
||||
|
||||
#define ADDR_INFO(cond, a) do {} while(0)
|
||||
|
||||
#define ADDR_WARN(cond, a) do {} while(0)
|
||||
|
||||
#define ADDR_EXIT(cond, a) do {} while(0)
|
||||
|
||||
#endif // DEBUG
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ADDR_C_ASSERT(__e) STATIC_ASSERT(__e)
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
|
||||
namespace V1
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Common constants
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static const UINT_32 MicroTileWidth = 8; ///< Micro tile width, for 1D and 2D tiling
|
||||
static const UINT_32 MicroTileHeight = 8; ///< Micro tile height, for 1D and 2D tiling
|
||||
static const UINT_32 ThickTileThickness = 4; ///< Micro tile thickness, for THICK modes
|
||||
static const UINT_32 XThickTileThickness = 8; ///< Extra thick tiling thickness
|
||||
static const UINT_32 PowerSaveTileBytes = 64; ///< Nuber of bytes per tile for power save 64
|
||||
static const UINT_32 CmaskCacheBits = 1024; ///< Number of bits for CMASK cache
|
||||
static const UINT_32 CmaskElemBits = 4; ///< Number of bits for CMASK element
|
||||
static const UINT_32 HtileCacheBits = 16384; ///< Number of bits for HTILE cache 512*32
|
||||
|
||||
static const UINT_32 MicroTilePixels = MicroTileWidth * MicroTileHeight;
|
||||
|
||||
static const INT_32 TileIndexInvalid = TILEINDEX_INVALID;
|
||||
static const INT_32 TileIndexLinearGeneral = TILEINDEX_LINEAR_GENERAL;
|
||||
static const INT_32 TileIndexNoMacroIndex = -3;
|
||||
|
||||
} // V1
|
||||
|
||||
namespace V2
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Common constants
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static const UINT_32 MaxSurfaceHeight = 16384;
|
||||
|
||||
} // V2
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Common macros
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define BITS_PER_BYTE 8
|
||||
#define BITS_TO_BYTES(x) ( ((x) + (BITS_PER_BYTE-1)) / BITS_PER_BYTE )
|
||||
#define BYTES_TO_BITS(x) ( (x) * BITS_PER_BYTE )
|
||||
|
||||
/// Helper macros to select a single bit from an int (undefined later in section)
|
||||
#define _BIT(v,b) (((v) >> (b) ) & 1)
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums to identify AddrLib type
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum LibClass
|
||||
{
|
||||
BASE_ADDRLIB = 0x0,
|
||||
R600_ADDRLIB = 0x6,
|
||||
R800_ADDRLIB = 0x8,
|
||||
SI_ADDRLIB = 0xa,
|
||||
CI_ADDRLIB = 0xb,
|
||||
AI_ADDRLIB = 0xd,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* ChipFamily
|
||||
*
|
||||
* @brief
|
||||
* Neutral enums that specifies chip family.
|
||||
*
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum ChipFamily
|
||||
{
|
||||
ADDR_CHIP_FAMILY_IVLD, ///< Invalid family
|
||||
ADDR_CHIP_FAMILY_R6XX,
|
||||
ADDR_CHIP_FAMILY_R7XX,
|
||||
ADDR_CHIP_FAMILY_R8XX,
|
||||
ADDR_CHIP_FAMILY_NI,
|
||||
ADDR_CHIP_FAMILY_SI,
|
||||
ADDR_CHIP_FAMILY_CI,
|
||||
ADDR_CHIP_FAMILY_VI,
|
||||
ADDR_CHIP_FAMILY_AI,
|
||||
ADDR_CHIP_FAMILY_NAVI,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* ConfigFlags
|
||||
*
|
||||
* @brief
|
||||
* This structure is used to set configuration flags.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
union ConfigFlags
|
||||
{
|
||||
struct
|
||||
{
|
||||
/// These flags are set up internally thru AddrLib::Create() based on ADDR_CREATE_FLAGS
|
||||
UINT_32 optimalBankSwap : 1; ///< New bank tiling for RV770 only
|
||||
UINT_32 noCubeMipSlicesPad : 1; ///< Disables faces padding for cubemap mipmaps
|
||||
UINT_32 fillSizeFields : 1; ///< If clients fill size fields in all input and
|
||||
/// output structure
|
||||
UINT_32 ignoreTileInfo : 1; ///< Don't use tile info structure
|
||||
UINT_32 useTileIndex : 1; ///< Make tileIndex field in input valid
|
||||
UINT_32 useCombinedSwizzle : 1; ///< Use combined swizzle
|
||||
UINT_32 checkLast2DLevel : 1; ///< Check the last 2D mip sub level
|
||||
UINT_32 useHtileSliceAlign : 1; ///< Do htile single slice alignment
|
||||
UINT_32 allowLargeThickTile : 1; ///< Allow 64*thickness*bytesPerPixel > rowSize
|
||||
UINT_32 disableLinearOpt : 1; ///< Disallow tile modes to be optimized to linear
|
||||
UINT_32 use32bppFor422Fmt : 1; ///< View 422 formats as 32 bits per pixel element
|
||||
UINT_32 forceDccAndTcCompat : 1; ///< Force enable DCC and TC compatibility
|
||||
UINT_32 nonPower2MemConfig : 1; ///< Physical video memory size is not power of 2
|
||||
UINT_32 reserved : 19; ///< Reserved bits for future use
|
||||
};
|
||||
|
||||
UINT_32 value;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Misc helper functions
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* AddrXorReduce
|
||||
*
|
||||
* @brief
|
||||
* Xor the right-side numberOfBits bits of x.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 XorReduce(
|
||||
UINT_32 x,
|
||||
UINT_32 numberOfBits)
|
||||
{
|
||||
UINT_32 i;
|
||||
UINT_32 result = x & 1;
|
||||
|
||||
for (i=1; i<numberOfBits; i++)
|
||||
{
|
||||
result ^= ((x>>i) & 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* IsPow2
|
||||
*
|
||||
* @brief
|
||||
* Check if the size (UINT_32) is pow 2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 IsPow2(
|
||||
UINT_32 dim) ///< [in] dimension of miplevel
|
||||
{
|
||||
ADDR_ASSERT(dim > 0);
|
||||
return !(dim & (dim - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* IsPow2
|
||||
*
|
||||
* @brief
|
||||
* Check if the size (UINT_64) is pow 2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_64 IsPow2(
|
||||
UINT_64 dim) ///< [in] dimension of miplevel
|
||||
{
|
||||
ADDR_ASSERT(dim > 0);
|
||||
return !(dim & (dim - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* ByteAlign
|
||||
*
|
||||
* @brief
|
||||
* Align UINT_32 "x" to "align" alignment, "align" should be power of 2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 PowTwoAlign(
|
||||
UINT_32 x,
|
||||
UINT_32 align)
|
||||
{
|
||||
//
|
||||
// Assert that x is a power of two.
|
||||
//
|
||||
ADDR_ASSERT(IsPow2(align));
|
||||
return (x + (align - 1)) & (~(align - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* ByteAlign
|
||||
*
|
||||
* @brief
|
||||
* Align UINT_64 "x" to "align" alignment, "align" should be power of 2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_64 PowTwoAlign(
|
||||
UINT_64 x,
|
||||
UINT_64 align)
|
||||
{
|
||||
//
|
||||
// Assert that x is a power of two.
|
||||
//
|
||||
ADDR_ASSERT(IsPow2(align));
|
||||
return (x + (align - 1)) & (~(align - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Min
|
||||
*
|
||||
* @brief
|
||||
* Get the min value between two unsigned values
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 Min(
|
||||
UINT_32 value1,
|
||||
UINT_32 value2)
|
||||
{
|
||||
return ((value1 < (value2)) ? (value1) : value2);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Min
|
||||
*
|
||||
* @brief
|
||||
* Get the min value between two signed values
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline INT_32 Min(
|
||||
INT_32 value1,
|
||||
INT_32 value2)
|
||||
{
|
||||
return ((value1 < (value2)) ? (value1) : value2);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Max
|
||||
*
|
||||
* @brief
|
||||
* Get the max value between two unsigned values
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 Max(
|
||||
UINT_32 value1,
|
||||
UINT_32 value2)
|
||||
{
|
||||
return ((value1 > (value2)) ? (value1) : value2);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Max
|
||||
*
|
||||
* @brief
|
||||
* Get the max value between two signed values
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline INT_32 Max(
|
||||
INT_32 value1,
|
||||
INT_32 value2)
|
||||
{
|
||||
return ((value1 > (value2)) ? (value1) : value2);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* NextPow2
|
||||
*
|
||||
* @brief
|
||||
* Compute the mipmap's next level dim size
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 NextPow2(
|
||||
UINT_32 dim) ///< [in] dimension of miplevel
|
||||
{
|
||||
UINT_32 newDim = 1;
|
||||
|
||||
if (dim > 0x7fffffff)
|
||||
{
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
newDim = 0x80000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (newDim < dim)
|
||||
{
|
||||
newDim <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return newDim;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Log2NonPow2
|
||||
*
|
||||
* @brief
|
||||
* Compute log of base 2 no matter the target is power of 2 or not
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 Log2NonPow2(
|
||||
UINT_32 x) ///< [in] the value should calculate log based 2
|
||||
{
|
||||
UINT_32 y;
|
||||
|
||||
y = 0;
|
||||
while (x > 1)
|
||||
{
|
||||
x >>= 1;
|
||||
y++;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Log2
|
||||
*
|
||||
* @brief
|
||||
* Compute log of base 2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 Log2(
|
||||
UINT_32 x) ///< [in] the value should calculate log based 2
|
||||
{
|
||||
// Assert that x is a power of two.
|
||||
ADDR_ASSERT(IsPow2(x));
|
||||
|
||||
return Log2NonPow2(x);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* QLog2
|
||||
*
|
||||
* @brief
|
||||
* Compute log of base 2 quickly (<= 16)
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 QLog2(
|
||||
UINT_32 x) ///< [in] the value should calculate log based 2
|
||||
{
|
||||
ADDR_ASSERT(x <= 16);
|
||||
|
||||
UINT_32 y = 0;
|
||||
|
||||
switch (x)
|
||||
{
|
||||
case 1:
|
||||
y = 0;
|
||||
break;
|
||||
case 2:
|
||||
y = 1;
|
||||
break;
|
||||
case 4:
|
||||
y = 2;
|
||||
break;
|
||||
case 8:
|
||||
y = 3;
|
||||
break;
|
||||
case 16:
|
||||
y = 4;
|
||||
break;
|
||||
default:
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* SafeAssign
|
||||
*
|
||||
* @brief
|
||||
* NULL pointer safe assignment
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline VOID SafeAssign(
|
||||
UINT_32* pLVal, ///< [in] Pointer to left val
|
||||
UINT_32 rVal) ///< [in] Right value
|
||||
{
|
||||
if (pLVal)
|
||||
{
|
||||
*pLVal = rVal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* SafeAssign
|
||||
*
|
||||
* @brief
|
||||
* NULL pointer safe assignment for 64bit values
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline VOID SafeAssign(
|
||||
UINT_64* pLVal, ///< [in] Pointer to left val
|
||||
UINT_64 rVal) ///< [in] Right value
|
||||
{
|
||||
if (pLVal)
|
||||
{
|
||||
*pLVal = rVal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* SafeAssign
|
||||
*
|
||||
* @brief
|
||||
* NULL pointer safe assignment for AddrTileMode
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline VOID SafeAssign(
|
||||
AddrTileMode* pLVal, ///< [in] Pointer to left val
|
||||
AddrTileMode rVal) ///< [in] Right value
|
||||
{
|
||||
if (pLVal)
|
||||
{
|
||||
*pLVal = rVal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* RoundHalf
|
||||
*
|
||||
* @brief
|
||||
* return (x + 1) / 2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 RoundHalf(
|
||||
UINT_32 x) ///< [in] input value
|
||||
{
|
||||
ADDR_ASSERT(x != 0);
|
||||
|
||||
#if 1
|
||||
return (x >> 1) + (x & 1);
|
||||
#else
|
||||
return (x + 1) >> 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* SumGeo
|
||||
*
|
||||
* @brief
|
||||
* Calculate sum of a geometric progression whose ratio is 1/2
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 SumGeo(
|
||||
UINT_32 base, ///< [in] First term in the geometric progression
|
||||
UINT_32 num) ///< [in] Number of terms to be added into sum
|
||||
{
|
||||
ADDR_ASSERT(base > 0);
|
||||
|
||||
UINT_32 sum = 0;
|
||||
UINT_32 i = 0;
|
||||
for (; (i < num) && (base > 1); i++)
|
||||
{
|
||||
sum += base;
|
||||
base = RoundHalf(base);
|
||||
}
|
||||
sum += num - i;
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* GetBit
|
||||
*
|
||||
* @brief
|
||||
* Extract bit N value (0 or 1) of a UINT32 value.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 GetBit(
|
||||
UINT_32 u32, ///< [in] UINT32 value
|
||||
UINT_32 pos) ///< [in] bit position from LSB, valid range is [0..31]
|
||||
{
|
||||
ADDR_ASSERT(pos <= 31);
|
||||
|
||||
return (u32 >> pos) & 0x1;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* GetBits
|
||||
*
|
||||
* @brief
|
||||
* Copy 'bitsNum' bits from src start from srcStartPos into destination from dstStartPos
|
||||
* srcStartPos: 0~31 for UINT_32
|
||||
* bitsNum : 1~32 for UINT_32
|
||||
* srcStartPos: 0~31 for UINT_32
|
||||
* src start position
|
||||
* |
|
||||
* src : b[31] b[30] b[29] ... ... ... ... ... ... ... ... b[end]..b[beg] ... b[1] b[0]
|
||||
* || Bits num || copy length || Bits num ||
|
||||
* dst : b[31] b[30] b[29] ... b[end]..b[beg] ... ... ... ... ... ... ... ... b[1] b[0]
|
||||
* |
|
||||
* dst start position
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 GetBits(
|
||||
UINT_32 src,
|
||||
UINT_32 srcStartPos,
|
||||
UINT_32 bitsNum,
|
||||
UINT_32 dstStartPos)
|
||||
{
|
||||
ADDR_ASSERT((srcStartPos < 32) && (dstStartPos < 32) && (bitsNum > 0));
|
||||
ADDR_ASSERT((bitsNum + dstStartPos <= 32) && (bitsNum + srcStartPos <= 32));
|
||||
|
||||
return ((src >> srcStartPos) << (32 - bitsNum)) >> (32 - bitsNum - dstStartPos);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* MortonGen2d
|
||||
*
|
||||
* @brief
|
||||
* Generate 2D Morton interleave code with num lowest bits in each channel
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 MortonGen2d(
|
||||
UINT_32 x, ///< [in] First channel
|
||||
UINT_32 y, ///< [in] Second channel
|
||||
UINT_32 num) ///< [in] Number of bits extracted from each channel
|
||||
{
|
||||
UINT_32 mort = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < num; i++)
|
||||
{
|
||||
mort |= (GetBit(y, i) << (2 * i));
|
||||
mort |= (GetBit(x, i) << (2 * i + 1));
|
||||
}
|
||||
|
||||
return mort;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* MortonGen3d
|
||||
*
|
||||
* @brief
|
||||
* Generate 3D Morton interleave code with num lowest bits in each channel
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 MortonGen3d(
|
||||
UINT_32 x, ///< [in] First channel
|
||||
UINT_32 y, ///< [in] Second channel
|
||||
UINT_32 z, ///< [in] Third channel
|
||||
UINT_32 num) ///< [in] Number of bits extracted from each channel
|
||||
{
|
||||
UINT_32 mort = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < num; i++)
|
||||
{
|
||||
mort |= (GetBit(z, i) << (3 * i));
|
||||
mort |= (GetBit(y, i) << (3 * i + 1));
|
||||
mort |= (GetBit(x, i) << (3 * i + 2));
|
||||
}
|
||||
|
||||
return mort;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* ReverseBitVector
|
||||
*
|
||||
* @brief
|
||||
* Return reversed lowest num bits of v: v[0]v[1]...v[num-2]v[num-1]
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 ReverseBitVector(
|
||||
UINT_32 v, ///< [in] Reverse operation base value
|
||||
UINT_32 num) ///< [in] Number of bits used in reverse operation
|
||||
{
|
||||
UINT_32 reverse = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < num; i++)
|
||||
{
|
||||
reverse |= (GetBit(v, num - 1 - i) << i);
|
||||
}
|
||||
|
||||
return reverse;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* FoldXor2d
|
||||
*
|
||||
* @brief
|
||||
* Xor bit vector v[num-1]v[num-2]...v[1]v[0] with v[num]v[num+1]...v[2*num-2]v[2*num-1]
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 FoldXor2d(
|
||||
UINT_32 v, ///< [in] Xor operation base value
|
||||
UINT_32 num) ///< [in] Number of bits used in fold xor operation
|
||||
{
|
||||
return (v & ((1 << num) - 1)) ^ ReverseBitVector(v >> num, num);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* DeMort
|
||||
*
|
||||
* @brief
|
||||
* Return v[0] | v[2] | v[4] | v[6]... | v[2*num - 2]
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 DeMort(
|
||||
UINT_32 v, ///< [in] DeMort operation base value
|
||||
UINT_32 num) ///< [in] Number of bits used in fold DeMort operation
|
||||
{
|
||||
UINT_32 d = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < num; i++)
|
||||
{
|
||||
d |= ((v & (1 << (i << 1))) >> i);
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* FoldXor3d
|
||||
*
|
||||
* @brief
|
||||
* v[0]...v[num-1] ^ v[3*num-1]v[3*num-3]...v[num+2]v[num] ^ v[3*num-2]...v[num+1]v[num-1]
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 FoldXor3d(
|
||||
UINT_32 v, ///< [in] Xor operation base value
|
||||
UINT_32 num) ///< [in] Number of bits used in fold xor operation
|
||||
{
|
||||
UINT_32 t = v & ((1 << num) - 1);
|
||||
t ^= ReverseBitVector(DeMort(v >> num, num), num);
|
||||
t ^= ReverseBitVector(DeMort(v >> (num + 1), num), num);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* InitChannel
|
||||
*
|
||||
* @brief
|
||||
* Set channel initialization value via a return value
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline ADDR_CHANNEL_SETTING InitChannel(
|
||||
UINT_32 valid, ///< [in] valid setting
|
||||
UINT_32 channel, ///< [in] channel setting
|
||||
UINT_32 index) ///< [in] index setting
|
||||
{
|
||||
ADDR_CHANNEL_SETTING t;
|
||||
t.valid = valid;
|
||||
t.channel = channel;
|
||||
t.index = index;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* InitChannel
|
||||
*
|
||||
* @brief
|
||||
* Set channel initialization value via channel pointer
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline VOID InitChannel(
|
||||
UINT_32 valid, ///< [in] valid setting
|
||||
UINT_32 channel, ///< [in] channel setting
|
||||
UINT_32 index, ///< [in] index setting
|
||||
ADDR_CHANNEL_SETTING *pChanSet) ///< [out] channel setting to be initialized
|
||||
{
|
||||
pChanSet->valid = valid;
|
||||
pChanSet->channel = channel;
|
||||
pChanSet->index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* InitChannel
|
||||
*
|
||||
* @brief
|
||||
* Set channel initialization value via another channel
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline VOID InitChannel(
|
||||
ADDR_CHANNEL_SETTING *pChanDst, ///< [in] channel setting to be copied from
|
||||
ADDR_CHANNEL_SETTING *pChanSrc) ///< [out] channel setting to be initialized
|
||||
{
|
||||
pChanDst->valid = pChanSrc->valid;
|
||||
pChanDst->channel = pChanSrc->channel;
|
||||
pChanDst->index = pChanSrc->index;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* GetMaxValidChannelIndex
|
||||
*
|
||||
* @brief
|
||||
* Get max valid index for a specific channel
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 GetMaxValidChannelIndex(
|
||||
const ADDR_CHANNEL_SETTING *pChanSet, ///< [in] channel setting to be initialized
|
||||
UINT_32 searchCount,///< [in] number of channel setting to be searched
|
||||
UINT_32 channel) ///< [in] channel to be searched
|
||||
{
|
||||
UINT_32 index = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < searchCount; i++)
|
||||
{
|
||||
if (pChanSet[i].valid && (pChanSet[i].channel == channel))
|
||||
{
|
||||
index = Max(index, static_cast<UINT_32>(pChanSet[i].index));
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* GetCoordActiveMask
|
||||
*
|
||||
* @brief
|
||||
* Get bit mask which indicates which positions in the equation match the target coord
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 GetCoordActiveMask(
|
||||
const ADDR_CHANNEL_SETTING *pChanSet, ///< [in] channel setting to be initialized
|
||||
UINT_32 searchCount,///< [in] number of channel setting to be searched
|
||||
UINT_32 channel, ///< [in] channel to be searched
|
||||
UINT_32 index) ///< [in] index to be searched
|
||||
{
|
||||
UINT_32 mask = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < searchCount; i++)
|
||||
{
|
||||
if ((pChanSet[i].valid == TRUE) &&
|
||||
(pChanSet[i].channel == channel) &&
|
||||
(pChanSet[i].index == index))
|
||||
{
|
||||
mask |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* ShiftCeil
|
||||
*
|
||||
* @brief
|
||||
* Apply righ-shift with ceiling
|
||||
****************************************************************************************************
|
||||
*/
|
||||
static inline UINT_32 ShiftCeil(
|
||||
UINT_32 a, ///< [in] value to be right-shifted
|
||||
UINT_32 b) ///< [in] number of bits to shift
|
||||
{
|
||||
return (a >> b) + (((a & ((1 << b) - 1)) != 0) ? 1 : 0);
|
||||
}
|
||||
|
||||
} // Addr
|
||||
|
||||
#endif // __ADDR_COMMON_H__
|
||||
|
||||
+1830
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,279 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrelemlib.h
|
||||
* @brief Contains the class for element/pixel related functions.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ELEM_LIB_H__
|
||||
#define __ELEM_LIB_H__
|
||||
|
||||
#include "addrinterface.h"
|
||||
#include "addrobject.h"
|
||||
#include "addrcommon.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
|
||||
class Lib;
|
||||
|
||||
// The masks for property bits within the Properties INT_32
|
||||
union ComponentFlags
|
||||
{
|
||||
struct
|
||||
{
|
||||
UINT_32 byteAligned : 1; ///< all components are byte aligned
|
||||
UINT_32 exportNorm : 1; ///< components support R6xx NORM compression
|
||||
UINT_32 floatComp : 1; ///< there is at least one floating point component
|
||||
};
|
||||
|
||||
UINT_32 value;
|
||||
};
|
||||
|
||||
// Copy from legacy lib's NumberType
|
||||
enum NumberType
|
||||
{
|
||||
// The following number types have the range [-1..1]
|
||||
ADDR_NO_NUMBER, // This component doesn't exist and has no default value
|
||||
ADDR_EPSILON, // Force component value to integer 0x00000001
|
||||
ADDR_ZERO, // Force component value to integer 0x00000000
|
||||
ADDR_ONE, // Force component value to floating point 1.0
|
||||
// Above values don't have any bits per component (keep ADDR_ONE the last of these)
|
||||
|
||||
ADDR_UNORM, // Unsigned normalized (repeating fraction) full precision
|
||||
ADDR_SNORM, // Signed normalized (repeating fraction) full precision
|
||||
ADDR_GAMMA, // Gamma-corrected, full precision
|
||||
|
||||
ADDR_UNORM_R5XXRB, // Unsigned normalized (repeating fraction) for r5xx RB
|
||||
ADDR_SNORM_R5XXRB, // Signed normalized (repeating fraction) for r5xx RB
|
||||
ADDR_GAMMA_R5XXRB, // Gamma-corrected for r5xx RB (note: unnormalized value)
|
||||
ADDR_UNORM_R5XXBC, // Unsigned normalized (repeating fraction) for r5xx BC
|
||||
ADDR_SNORM_R5XXBC, // Signed normalized (repeating fraction) for r5xx BC
|
||||
ADDR_GAMMA_R5XXBC, // Gamma-corrected for r5xx BC (note: unnormalized value)
|
||||
|
||||
ADDR_UNORM_R6XX, // Unsigned normalized (repeating fraction) for R6xx
|
||||
ADDR_UNORM_R6XXDB, // Unorms for 24-bit depth: one value differs from ADDR_UNORM_R6XX
|
||||
ADDR_SNORM_R6XX, // Signed normalized (repeating fraction) for R6xx
|
||||
ADDR_GAMMA8_R6XX, // Gamma-corrected for r6xx
|
||||
ADDR_GAMMA8_R7XX_TP, // Gamma-corrected for r7xx TP 12bit unorm 8.4.
|
||||
|
||||
ADDR_U4FLOATC, // Unsigned float: 4-bit exponent, bias=15, no NaN, clamp [0..1]
|
||||
ADDR_GAMMA_4SEG, // Gamma-corrected, four segment approximation
|
||||
ADDR_U0FIXED, // Unsigned 0.N-bit fixed point
|
||||
|
||||
// The following number types have large ranges (LEAVE ADDR_USCALED first or fix Finish routine)
|
||||
ADDR_USCALED, // Unsigned integer converted to/from floating point
|
||||
ADDR_SSCALED, // Signed integer converted to/from floating point
|
||||
ADDR_USCALED_R5XXRB, // Unsigned integer to/from floating point for r5xx RB
|
||||
ADDR_SSCALED_R5XXRB, // Signed integer to/from floating point for r5xx RB
|
||||
ADDR_UINT_BITS, // Keep in unsigned integer form, clamped to specified range
|
||||
ADDR_SINT_BITS, // Keep in signed integer form, clamped to specified range
|
||||
ADDR_UINTBITS, // @@ remove Keep in unsigned integer form, use modulus to reduce bits
|
||||
ADDR_SINTBITS, // @@ remove Keep in signed integer form, use modulus to reduce bits
|
||||
|
||||
// The following number types and ADDR_U4FLOATC have exponents
|
||||
// (LEAVE ADDR_S8FLOAT first or fix Finish routine)
|
||||
ADDR_S8FLOAT, // Signed floating point with 8-bit exponent, bias=127
|
||||
ADDR_S8FLOAT32, // 32-bit IEEE float, passes through NaN values
|
||||
ADDR_S5FLOAT, // Signed floating point with 5-bit exponent, bias=15
|
||||
ADDR_S5FLOATM, // Signed floating point with 5-bit exponent, bias=15, no NaN/Inf
|
||||
ADDR_U5FLOAT, // Signed floating point with 5-bit exponent, bias=15
|
||||
ADDR_U3FLOATM, // Unsigned floating point with 3-bit exponent, bias=3
|
||||
|
||||
ADDR_S5FIXED, // Signed 5.N-bit fixed point, with rounding
|
||||
|
||||
ADDR_END_NUMBER // Used for range comparisons
|
||||
};
|
||||
|
||||
// Copy from legacy lib's AddrElement
|
||||
enum ElemMode
|
||||
{
|
||||
// These formats allow both packing an unpacking
|
||||
ADDR_ROUND_BY_HALF, // add 1/2 and truncate when packing this element
|
||||
ADDR_ROUND_TRUNCATE, // truncate toward 0 for sign/mag, else toward neg
|
||||
ADDR_ROUND_DITHER, // Pack by dithering -- requires (x,y) position
|
||||
|
||||
// These formats only allow unpacking, no packing
|
||||
ADDR_UNCOMPRESSED, // Elements are not compressed: one data element per pixel/texel
|
||||
ADDR_EXPANDED, // Elements are split up and stored in multiple data elements
|
||||
ADDR_PACKED_STD, // Elements are compressed into ExpandX by ExpandY data elements
|
||||
ADDR_PACKED_REV, // Like ADDR_PACKED, but X order of pixels is reverved
|
||||
ADDR_PACKED_GBGR, // Elements are compressed 4:2:2 in G1B_G0R order (high to low)
|
||||
ADDR_PACKED_BGRG, // Elements are compressed 4:2:2 in BG1_RG0 order (high to low)
|
||||
ADDR_PACKED_BC1, // Each data element is uncompressed to a 4x4 pixel/texel array
|
||||
ADDR_PACKED_BC2, // Each data element is uncompressed to a 4x4 pixel/texel array
|
||||
ADDR_PACKED_BC3, // Each data element is uncompressed to a 4x4 pixel/texel array
|
||||
ADDR_PACKED_BC4, // Each data element is uncompressed to a 4x4 pixel/texel array
|
||||
ADDR_PACKED_BC5, // Each data element is uncompressed to a 4x4 pixel/texel array
|
||||
ADDR_PACKED_ETC2_64BPP, // ETC2 formats that use 64bpp to represent each 4x4 block
|
||||
ADDR_PACKED_ETC2_128BPP, // ETC2 formats that use 128bpp to represent each 4x4 block
|
||||
ADDR_PACKED_ASTC, // Various ASTC formats, all are 128bpp with varying block sizes
|
||||
|
||||
// These formats provide various kinds of compression
|
||||
ADDR_ZPLANE_R5XX, // Compressed Zplane using r5xx architecture format
|
||||
ADDR_ZPLANE_R6XX, // Compressed Zplane using r6xx architecture format
|
||||
//@@ Fill in the compression modes
|
||||
|
||||
ADDR_END_ELEMENT // Used for range comparisons
|
||||
};
|
||||
|
||||
enum DepthPlanarType
|
||||
{
|
||||
ADDR_DEPTH_PLANAR_NONE = 0, // No plane z/stencl
|
||||
ADDR_DEPTH_PLANAR_R600 = 1, // R600 z and stencil planes are store within a tile
|
||||
ADDR_DEPTH_PLANAR_R800 = 2, // R800 has separate z and stencil planes
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* PixelFormatInfo
|
||||
*
|
||||
* @brief
|
||||
* Per component info
|
||||
*
|
||||
****************************************************************************************************
|
||||
*/
|
||||
struct PixelFormatInfo
|
||||
{
|
||||
UINT_32 compBit[4];
|
||||
NumberType numType[4];
|
||||
UINT_32 compStart[4];
|
||||
ElemMode elemMode;
|
||||
UINT_32 comps; ///< Number of components
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class contains asic indepentent element related attributes and operations
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class ElemLib : public Object
|
||||
{
|
||||
protected:
|
||||
ElemLib(Lib* pAddrLib);
|
||||
|
||||
public:
|
||||
|
||||
/// Makes this class virtual
|
||||
virtual ~ElemLib();
|
||||
|
||||
static ElemLib* Create(
|
||||
const Lib* pAddrLib);
|
||||
|
||||
/// The implementation is only for R6xx/R7xx, so make it virtual in case we need for R8xx
|
||||
BOOL_32 PixGetExportNorm(
|
||||
AddrColorFormat colorFmt,
|
||||
AddrSurfaceNumber numberFmt, AddrSurfaceSwap swap) const;
|
||||
|
||||
/// Below method are asic independent, so make them just static.
|
||||
/// Remove static if we need different operation in hwl.
|
||||
|
||||
VOID Flt32ToDepthPixel(
|
||||
AddrDepthFormat format, const ADDR_FLT_32 comps[2], UINT_8 *pPixel) const;
|
||||
|
||||
VOID Flt32ToColorPixel(
|
||||
AddrColorFormat format, AddrSurfaceNumber surfNum, AddrSurfaceSwap surfSwap,
|
||||
const ADDR_FLT_32 comps[4], UINT_8 *pPixel) const;
|
||||
|
||||
static VOID Flt32sToInt32s(
|
||||
ADDR_FLT_32 value, UINT_32 bits, NumberType numberType, UINT_32* pResult);
|
||||
|
||||
static VOID Int32sToPixel(
|
||||
UINT_32 numComps, UINT_32* pComps, UINT_32* pCompBits, UINT_32* pCompStart,
|
||||
ComponentFlags properties, UINT_32 resultBits, UINT_8* pPixel);
|
||||
|
||||
VOID PixGetColorCompInfo(
|
||||
AddrColorFormat format, AddrSurfaceNumber number, AddrSurfaceSwap swap,
|
||||
PixelFormatInfo* pInfo) const;
|
||||
|
||||
VOID PixGetDepthCompInfo(
|
||||
AddrDepthFormat format, PixelFormatInfo* pInfo) const;
|
||||
|
||||
UINT_32 GetBitsPerPixel(
|
||||
AddrFormat format, ElemMode* pElemMode = NULL,
|
||||
UINT_32* pExpandX = NULL, UINT_32* pExpandY = NULL, UINT_32* pBitsUnused = NULL);
|
||||
|
||||
static VOID SetClearComps(
|
||||
ADDR_FLT_32 comps[4], BOOL_32 clearColor, BOOL_32 float32);
|
||||
|
||||
VOID AdjustSurfaceInfo(
|
||||
ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
|
||||
UINT_32* pBpp, UINT_32* pBasePitch, UINT_32* pWidth, UINT_32* pHeight);
|
||||
|
||||
VOID RestoreSurfaceInfo(
|
||||
ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
|
||||
UINT_32* pBpp, UINT_32* pWidth, UINT_32* pHeight);
|
||||
|
||||
/// Checks if depth and stencil are planar inside a tile
|
||||
BOOL_32 IsDepthStencilTilePlanar()
|
||||
{
|
||||
return (m_depthPlanarType == ADDR_DEPTH_PLANAR_R600) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/// Sets m_configFlags, copied from AddrLib
|
||||
VOID SetConfigFlags(ConfigFlags flags)
|
||||
{
|
||||
m_configFlags = flags;
|
||||
}
|
||||
|
||||
static BOOL_32 IsCompressed(AddrFormat format);
|
||||
static BOOL_32 IsBlockCompressed(AddrFormat format);
|
||||
static BOOL_32 IsExpand3x(AddrFormat format);
|
||||
static BOOL_32 IsMacroPixelPacked(AddrFormat format);
|
||||
|
||||
protected:
|
||||
|
||||
static VOID GetCompBits(
|
||||
UINT_32 c0, UINT_32 c1, UINT_32 c2, UINT_32 c3,
|
||||
PixelFormatInfo* pInfo,
|
||||
ElemMode elemMode = ADDR_ROUND_BY_HALF);
|
||||
|
||||
static VOID GetCompType(
|
||||
AddrColorFormat format, AddrSurfaceNumber numType,
|
||||
PixelFormatInfo* pInfo);
|
||||
|
||||
static VOID GetCompSwap(
|
||||
AddrSurfaceSwap swap, PixelFormatInfo* pInfo);
|
||||
|
||||
static VOID SwapComps(
|
||||
UINT_32 c0, UINT_32 c1, PixelFormatInfo* pInfo);
|
||||
|
||||
private:
|
||||
|
||||
UINT_32 m_fp16ExportNorm; ///< If allow FP16 to be reported as EXPORT_NORM
|
||||
DepthPlanarType m_depthPlanarType;
|
||||
|
||||
ConfigFlags m_configFlags; ///< Copy of AddrLib's configFlags
|
||||
Addr::Lib* const m_pAddrLib; ///< Pointer to parent addrlib instance
|
||||
};
|
||||
|
||||
} //Addr
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,660 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrlib.cpp
|
||||
* @brief Contains the implementation for the Addr::Lib class.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#include "addrinterface.h"
|
||||
#include "addrlib.h"
|
||||
#include "addrcommon.h"
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
UINT_32 div64_32(UINT_64 n, UINT_32 base)
|
||||
{
|
||||
UINT_64 rem = n;
|
||||
UINT_64 b = base;
|
||||
UINT_64 res, d = 1;
|
||||
UINT_32 high = rem >> 32;
|
||||
|
||||
res = 0;
|
||||
if (high >= base)
|
||||
{
|
||||
high /= base;
|
||||
res = (UINT_64) high << 32;
|
||||
rem -= (UINT_64) (high * base) << 32;
|
||||
}
|
||||
|
||||
while (((INT_64)b > 0) && (b < rem))
|
||||
{
|
||||
b = b + b;
|
||||
d = d + d;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (rem >= b)
|
||||
{
|
||||
rem -= b;
|
||||
res += d;
|
||||
}
|
||||
b >>= 1;
|
||||
d >>= 1;
|
||||
} while (d);
|
||||
|
||||
n = res;
|
||||
return rem;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
UINT_32 __umoddi3(UINT_64 n, UINT_32 base)
|
||||
{
|
||||
return div64_32(n, base);
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor/Destructor
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::Lib
|
||||
*
|
||||
* @brief
|
||||
* Constructor for the AddrLib class
|
||||
*
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Lib::Lib() :
|
||||
m_class(BASE_ADDRLIB),
|
||||
m_chipFamily(ADDR_CHIP_FAMILY_IVLD),
|
||||
m_chipRevision(0),
|
||||
m_version(ADDRLIB_VERSION),
|
||||
m_pipes(0),
|
||||
m_banks(0),
|
||||
m_pipeInterleaveBytes(0),
|
||||
m_rowSize(0),
|
||||
m_minPitchAlignPixels(1),
|
||||
m_maxSamples(8),
|
||||
m_pElemLib(NULL)
|
||||
{
|
||||
m_configFlags.value = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::Lib
|
||||
*
|
||||
* @brief
|
||||
* Constructor for the AddrLib class with hClient as parameter
|
||||
*
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Lib::Lib(const Client* pClient) :
|
||||
Object(pClient),
|
||||
m_class(BASE_ADDRLIB),
|
||||
m_chipFamily(ADDR_CHIP_FAMILY_IVLD),
|
||||
m_chipRevision(0),
|
||||
m_version(ADDRLIB_VERSION),
|
||||
m_pipes(0),
|
||||
m_banks(0),
|
||||
m_pipeInterleaveBytes(0),
|
||||
m_rowSize(0),
|
||||
m_minPitchAlignPixels(1),
|
||||
m_maxSamples(8),
|
||||
m_pElemLib(NULL)
|
||||
{
|
||||
m_configFlags.value = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::~AddrLib
|
||||
*
|
||||
* @brief
|
||||
* Destructor for the AddrLib class
|
||||
*
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Lib::~Lib()
|
||||
{
|
||||
if (m_pElemLib)
|
||||
{
|
||||
delete m_pElemLib;
|
||||
m_pElemLib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Initialization/Helper
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::Create
|
||||
*
|
||||
* @brief
|
||||
* Creates and initializes AddrLib object.
|
||||
*
|
||||
* @return
|
||||
* ADDR_E_RETURNCODE
|
||||
****************************************************************************************************
|
||||
*/
|
||||
ADDR_E_RETURNCODE Lib::Create(
|
||||
const ADDR_CREATE_INPUT* pCreateIn, ///< [in] pointer to ADDR_CREATE_INPUT
|
||||
ADDR_CREATE_OUTPUT* pCreateOut) ///< [out] pointer to ADDR_CREATE_OUTPUT
|
||||
{
|
||||
Lib* pLib = NULL;
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
if (pCreateIn->createFlags.fillSizeFields == TRUE)
|
||||
{
|
||||
if ((pCreateIn->size != sizeof(ADDR_CREATE_INPUT)) ||
|
||||
(pCreateOut->size != sizeof(ADDR_CREATE_OUTPUT)))
|
||||
{
|
||||
returnCode = ADDR_PARAMSIZEMISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
if ((returnCode == ADDR_OK) &&
|
||||
(pCreateIn->callbacks.allocSysMem != NULL) &&
|
||||
(pCreateIn->callbacks.freeSysMem != NULL))
|
||||
{
|
||||
Client client = {
|
||||
pCreateIn->hClient,
|
||||
pCreateIn->callbacks
|
||||
};
|
||||
|
||||
switch (pCreateIn->chipEngine)
|
||||
{
|
||||
case CIASICIDGFXENGINE_SOUTHERNISLAND:
|
||||
switch (pCreateIn->chipFamily)
|
||||
{
|
||||
case FAMILY_SI:
|
||||
pLib = SiHwlInit(&client);
|
||||
break;
|
||||
case FAMILY_VI:
|
||||
case FAMILY_CZ:
|
||||
case FAMILY_CI:
|
||||
case FAMILY_KV: // CI based fusion
|
||||
pLib = CiHwlInit(&client);
|
||||
break;
|
||||
default:
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CIASICIDGFXENGINE_ARCTICISLAND:
|
||||
switch (pCreateIn->chipFamily)
|
||||
{
|
||||
case FAMILY_AI:
|
||||
case FAMILY_RV:
|
||||
pLib = Gfx9HwlInit(&client);
|
||||
break;
|
||||
case FAMILY_NV:
|
||||
pLib = Gfx10HwlInit(&client);
|
||||
break;
|
||||
default:
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pLib != NULL)
|
||||
{
|
||||
BOOL_32 initValid;
|
||||
|
||||
// Pass createFlags to configFlags first since these flags may be overwritten
|
||||
pLib->m_configFlags.noCubeMipSlicesPad = pCreateIn->createFlags.noCubeMipSlicesPad;
|
||||
pLib->m_configFlags.fillSizeFields = pCreateIn->createFlags.fillSizeFields;
|
||||
pLib->m_configFlags.useTileIndex = pCreateIn->createFlags.useTileIndex;
|
||||
pLib->m_configFlags.useCombinedSwizzle = pCreateIn->createFlags.useCombinedSwizzle;
|
||||
pLib->m_configFlags.checkLast2DLevel = pCreateIn->createFlags.checkLast2DLevel;
|
||||
pLib->m_configFlags.useHtileSliceAlign = pCreateIn->createFlags.useHtileSliceAlign;
|
||||
pLib->m_configFlags.allowLargeThickTile = pCreateIn->createFlags.allowLargeThickTile;
|
||||
pLib->m_configFlags.forceDccAndTcCompat = pCreateIn->createFlags.forceDccAndTcCompat;
|
||||
pLib->m_configFlags.nonPower2MemConfig = pCreateIn->createFlags.nonPower2MemConfig;
|
||||
pLib->m_configFlags.disableLinearOpt = FALSE;
|
||||
|
||||
pLib->SetChipFamily(pCreateIn->chipFamily, pCreateIn->chipRevision);
|
||||
|
||||
pLib->SetMinPitchAlignPixels(pCreateIn->minPitchAlignPixels);
|
||||
|
||||
// Global parameters initialized and remaining configFlags bits are set as well
|
||||
initValid = pLib->HwlInitGlobalParams(pCreateIn);
|
||||
|
||||
if (initValid)
|
||||
{
|
||||
pLib->m_pElemLib = ElemLib::Create(pLib);
|
||||
}
|
||||
else
|
||||
{
|
||||
pLib->m_pElemLib = NULL; // Don't go on allocating element lib
|
||||
returnCode = ADDR_INVALIDGBREGVALUES;
|
||||
}
|
||||
|
||||
if (pLib->m_pElemLib == NULL)
|
||||
{
|
||||
delete pLib;
|
||||
pLib = NULL;
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
}
|
||||
else
|
||||
{
|
||||
pLib->m_pElemLib->SetConfigFlags(pLib->m_configFlags);
|
||||
}
|
||||
}
|
||||
|
||||
pCreateOut->hLib = pLib;
|
||||
|
||||
if ((pLib != NULL) &&
|
||||
(returnCode == ADDR_OK))
|
||||
{
|
||||
pCreateOut->numEquations =
|
||||
pLib->HwlGetEquationTableInfo(&pCreateOut->pEquationTable);
|
||||
|
||||
pLib->SetMaxAlignments();
|
||||
|
||||
}
|
||||
else if ((pLib == NULL) &&
|
||||
(returnCode == ADDR_OK))
|
||||
{
|
||||
// Unknown failures, we return the general error code
|
||||
returnCode = ADDR_ERROR;
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::SetChipFamily
|
||||
*
|
||||
* @brief
|
||||
* Convert familyID defined in atiid.h to ChipFamily and set m_chipFamily/m_chipRevision
|
||||
* @return
|
||||
* N/A
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Lib::SetChipFamily(
|
||||
UINT_32 uChipFamily, ///< [in] chip family defined in atiih.h
|
||||
UINT_32 uChipRevision) ///< [in] chip revision defined in "asic_family"_id.h
|
||||
{
|
||||
ChipFamily family = HwlConvertChipFamily(uChipFamily, uChipRevision);
|
||||
|
||||
ADDR_ASSERT(family != ADDR_CHIP_FAMILY_IVLD);
|
||||
|
||||
m_chipFamily = family;
|
||||
m_chipRevision = uChipRevision;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::SetMinPitchAlignPixels
|
||||
*
|
||||
* @brief
|
||||
* Set m_minPitchAlignPixels with input param
|
||||
*
|
||||
* @return
|
||||
* N/A
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Lib::SetMinPitchAlignPixels(
|
||||
UINT_32 minPitchAlignPixels) ///< [in] minmum pitch alignment in pixels
|
||||
{
|
||||
m_minPitchAlignPixels = (minPitchAlignPixels == 0) ? 1 : minPitchAlignPixels;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::SetMaxAlignments
|
||||
*
|
||||
* @brief
|
||||
* Set max alignments
|
||||
*
|
||||
* @return
|
||||
* N/A
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Lib::SetMaxAlignments()
|
||||
{
|
||||
m_maxBaseAlign = HwlComputeMaxBaseAlignments();
|
||||
m_maxMetaBaseAlign = HwlComputeMaxMetaBaseAlignments();
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::GetLib
|
||||
*
|
||||
* @brief
|
||||
* Get AddrLib pointer
|
||||
*
|
||||
* @return
|
||||
* An AddrLib class pointer
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Lib* Lib::GetLib(
|
||||
ADDR_HANDLE hLib) ///< [in] handle of ADDR_HANDLE
|
||||
{
|
||||
return static_cast<Addr::Lib*>(hLib);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::GetMaxAlignments
|
||||
*
|
||||
* @brief
|
||||
* Gets maximum alignments for data surface (include FMask)
|
||||
*
|
||||
* @return
|
||||
* ADDR_E_RETURNCODE
|
||||
****************************************************************************************************
|
||||
*/
|
||||
ADDR_E_RETURNCODE Lib::GetMaxAlignments(
|
||||
ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut ///< [out] output structure
|
||||
) const
|
||||
{
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
if (GetFillSizeFieldsFlags() == TRUE)
|
||||
{
|
||||
if (pOut->size != sizeof(ADDR_GET_MAX_ALIGNMENTS_OUTPUT))
|
||||
{
|
||||
returnCode = ADDR_PARAMSIZEMISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnCode == ADDR_OK)
|
||||
{
|
||||
if (m_maxBaseAlign != 0)
|
||||
{
|
||||
pOut->baseAlign = m_maxBaseAlign;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnCode = ADDR_NOTIMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::GetMaxMetaAlignments
|
||||
*
|
||||
* @brief
|
||||
* Gets maximum alignments for metadata (CMask, DCC and HTile)
|
||||
*
|
||||
* @return
|
||||
* ADDR_E_RETURNCODE
|
||||
****************************************************************************************************
|
||||
*/
|
||||
ADDR_E_RETURNCODE Lib::GetMaxMetaAlignments(
|
||||
ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut ///< [out] output structure
|
||||
) const
|
||||
{
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
if (GetFillSizeFieldsFlags() == TRUE)
|
||||
{
|
||||
if (pOut->size != sizeof(ADDR_GET_MAX_ALIGNMENTS_OUTPUT))
|
||||
{
|
||||
returnCode = ADDR_PARAMSIZEMISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnCode == ADDR_OK)
|
||||
{
|
||||
if (m_maxMetaBaseAlign != 0)
|
||||
{
|
||||
pOut->baseAlign = m_maxMetaBaseAlign;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnCode = ADDR_NOTIMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::Bits2Number
|
||||
*
|
||||
* @brief
|
||||
* Cat a array of binary bit to a number
|
||||
*
|
||||
* @return
|
||||
* The number combined with the array of bits
|
||||
****************************************************************************************************
|
||||
*/
|
||||
UINT_32 Lib::Bits2Number(
|
||||
UINT_32 bitNum, ///< [in] how many bits
|
||||
...) ///< [in] varaible bits value starting from MSB
|
||||
{
|
||||
UINT_32 number = 0;
|
||||
UINT_32 i;
|
||||
va_list bits_ptr;
|
||||
|
||||
va_start(bits_ptr, bitNum);
|
||||
|
||||
for(i = 0; i < bitNum; i++)
|
||||
{
|
||||
number |= va_arg(bits_ptr, UINT_32);
|
||||
number <<= 1;
|
||||
}
|
||||
|
||||
number >>= 1;
|
||||
|
||||
va_end(bits_ptr);
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Element lib
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::Flt32ToColorPixel
|
||||
*
|
||||
* @brief
|
||||
* Convert a FLT_32 value to a depth/stencil pixel value
|
||||
* @return
|
||||
* ADDR_E_RETURNCODE
|
||||
****************************************************************************************************
|
||||
*/
|
||||
ADDR_E_RETURNCODE Lib::Flt32ToDepthPixel(
|
||||
const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
|
||||
ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
if (GetFillSizeFieldsFlags() == TRUE)
|
||||
{
|
||||
if ((pIn->size != sizeof(ELEM_FLT32TODEPTHPIXEL_INPUT)) ||
|
||||
(pOut->size != sizeof(ELEM_FLT32TODEPTHPIXEL_OUTPUT)))
|
||||
{
|
||||
returnCode = ADDR_PARAMSIZEMISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnCode == ADDR_OK)
|
||||
{
|
||||
GetElemLib()->Flt32ToDepthPixel(pIn->format, pIn->comps, pOut->pPixel);
|
||||
|
||||
UINT_32 depthBase = 0;
|
||||
UINT_32 stencilBase = 0;
|
||||
UINT_32 depthBits = 0;
|
||||
UINT_32 stencilBits = 0;
|
||||
|
||||
switch (pIn->format)
|
||||
{
|
||||
case ADDR_DEPTH_16:
|
||||
depthBits = 16;
|
||||
break;
|
||||
case ADDR_DEPTH_X8_24:
|
||||
case ADDR_DEPTH_8_24:
|
||||
case ADDR_DEPTH_X8_24_FLOAT:
|
||||
case ADDR_DEPTH_8_24_FLOAT:
|
||||
depthBase = 8;
|
||||
depthBits = 24;
|
||||
stencilBits = 8;
|
||||
break;
|
||||
case ADDR_DEPTH_32_FLOAT:
|
||||
depthBits = 32;
|
||||
break;
|
||||
case ADDR_DEPTH_X24_8_32_FLOAT:
|
||||
depthBase = 8;
|
||||
depthBits = 32;
|
||||
stencilBits = 8;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Overwrite base since R800 has no "tileBase"
|
||||
if (GetElemLib()->IsDepthStencilTilePlanar() == FALSE)
|
||||
{
|
||||
depthBase = 0;
|
||||
stencilBase = 0;
|
||||
}
|
||||
|
||||
depthBase *= 64;
|
||||
stencilBase *= 64;
|
||||
|
||||
pOut->stencilBase = stencilBase;
|
||||
pOut->depthBase = depthBase;
|
||||
pOut->depthBits = depthBits;
|
||||
pOut->stencilBits = stencilBits;
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::Flt32ToColorPixel
|
||||
*
|
||||
* @brief
|
||||
* Convert a FLT_32 value to a red/green/blue/alpha pixel value
|
||||
* @return
|
||||
* ADDR_E_RETURNCODE
|
||||
****************************************************************************************************
|
||||
*/
|
||||
ADDR_E_RETURNCODE Lib::Flt32ToColorPixel(
|
||||
const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
|
||||
ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
if (GetFillSizeFieldsFlags() == TRUE)
|
||||
{
|
||||
if ((pIn->size != sizeof(ELEM_FLT32TOCOLORPIXEL_INPUT)) ||
|
||||
(pOut->size != sizeof(ELEM_FLT32TOCOLORPIXEL_OUTPUT)))
|
||||
{
|
||||
returnCode = ADDR_PARAMSIZEMISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnCode == ADDR_OK)
|
||||
{
|
||||
GetElemLib()->Flt32ToColorPixel(pIn->format,
|
||||
pIn->surfNum,
|
||||
pIn->surfSwap,
|
||||
pIn->comps,
|
||||
pOut->pPixel);
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::GetExportNorm
|
||||
*
|
||||
* @brief
|
||||
* Check one format can be EXPORT_NUM
|
||||
* @return
|
||||
* TRUE if EXPORT_NORM can be used
|
||||
****************************************************************************************************
|
||||
*/
|
||||
BOOL_32 Lib::GetExportNorm(
|
||||
const ELEM_GETEXPORTNORM_INPUT* pIn) const
|
||||
{
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
BOOL_32 enabled = FALSE;
|
||||
|
||||
if (GetFillSizeFieldsFlags() == TRUE)
|
||||
{
|
||||
if (pIn->size != sizeof(ELEM_GETEXPORTNORM_INPUT))
|
||||
{
|
||||
returnCode = ADDR_PARAMSIZEMISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnCode == ADDR_OK)
|
||||
{
|
||||
enabled = GetElemLib()->PixGetExportNorm(pIn->format, pIn->num, pIn->swap);
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Lib::GetBpe
|
||||
*
|
||||
* @brief
|
||||
* Get bits-per-element for specified format
|
||||
* @return
|
||||
* bits-per-element of specified format
|
||||
****************************************************************************************************
|
||||
*/
|
||||
UINT_32 Lib::GetBpe(AddrFormat format) const
|
||||
{
|
||||
return GetElemLib()->GetBitsPerPixel(format);
|
||||
}
|
||||
|
||||
} // Addr
|
||||
@@ -0,0 +1,415 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrlib.h
|
||||
* @brief Contains the Addr::Lib base class definition.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ADDR_LIB_H__
|
||||
#define __ADDR_LIB_H__
|
||||
|
||||
#include "addrinterface.h"
|
||||
#include "addrobject.h"
|
||||
#include "addrelemlib.h"
|
||||
|
||||
#include "amdgpu_asic_addr.h"
|
||||
|
||||
#ifndef CIASICIDGFXENGINE_R600
|
||||
#define CIASICIDGFXENGINE_R600 0x00000006
|
||||
#endif
|
||||
|
||||
#ifndef CIASICIDGFXENGINE_R800
|
||||
#define CIASICIDGFXENGINE_R800 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef CIASICIDGFXENGINE_SOUTHERNISLAND
|
||||
#define CIASICIDGFXENGINE_SOUTHERNISLAND 0x0000000A
|
||||
#endif
|
||||
|
||||
#ifndef CIASICIDGFXENGINE_ARCTICISLAND
|
||||
#define CIASICIDGFXENGINE_ARCTICISLAND 0x0000000D
|
||||
#endif
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Neutral enums that define pipeinterleave
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum PipeInterleave
|
||||
{
|
||||
ADDR_PIPEINTERLEAVE_256B = 256,
|
||||
ADDR_PIPEINTERLEAVE_512B = 512,
|
||||
ADDR_PIPEINTERLEAVE_1KB = 1024,
|
||||
ADDR_PIPEINTERLEAVE_2KB = 2048,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Neutral enums that define DRAM row size
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum RowSize
|
||||
{
|
||||
ADDR_ROWSIZE_1KB = 1024,
|
||||
ADDR_ROWSIZE_2KB = 2048,
|
||||
ADDR_ROWSIZE_4KB = 4096,
|
||||
ADDR_ROWSIZE_8KB = 8192,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Neutral enums that define bank interleave
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum BankInterleave
|
||||
{
|
||||
ADDR_BANKINTERLEAVE_1 = 1,
|
||||
ADDR_BANKINTERLEAVE_2 = 2,
|
||||
ADDR_BANKINTERLEAVE_4 = 4,
|
||||
ADDR_BANKINTERLEAVE_8 = 8,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Neutral enums that define shader engine tile size
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum ShaderEngineTileSize
|
||||
{
|
||||
ADDR_SE_TILESIZE_16 = 16,
|
||||
ADDR_SE_TILESIZE_32 = 32,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Neutral enums that define bank swap size
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum BankSwapSize
|
||||
{
|
||||
ADDR_BANKSWAP_128B = 128,
|
||||
ADDR_BANKSWAP_256B = 256,
|
||||
ADDR_BANKSWAP_512B = 512,
|
||||
ADDR_BANKSWAP_1KB = 1024,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define max compressed fragments config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum NumMaxCompressedFragmentsConfig
|
||||
{
|
||||
ADDR_CONFIG_1_MAX_COMPRESSED_FRAGMENTS = 0x00000000,
|
||||
ADDR_CONFIG_2_MAX_COMPRESSED_FRAGMENTS = 0x00000001,
|
||||
ADDR_CONFIG_4_MAX_COMPRESSED_FRAGMENTS = 0x00000002,
|
||||
ADDR_CONFIG_8_MAX_COMPRESSED_FRAGMENTS = 0x00000003,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define num pipes config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum NumPipesConfig
|
||||
{
|
||||
ADDR_CONFIG_1_PIPE = 0x00000000,
|
||||
ADDR_CONFIG_2_PIPE = 0x00000001,
|
||||
ADDR_CONFIG_4_PIPE = 0x00000002,
|
||||
ADDR_CONFIG_8_PIPE = 0x00000003,
|
||||
ADDR_CONFIG_16_PIPE = 0x00000004,
|
||||
ADDR_CONFIG_32_PIPE = 0x00000005,
|
||||
ADDR_CONFIG_64_PIPE = 0x00000006,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define num banks config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum NumBanksConfig
|
||||
{
|
||||
ADDR_CONFIG_1_BANK = 0x00000000,
|
||||
ADDR_CONFIG_2_BANK = 0x00000001,
|
||||
ADDR_CONFIG_4_BANK = 0x00000002,
|
||||
ADDR_CONFIG_8_BANK = 0x00000003,
|
||||
ADDR_CONFIG_16_BANK = 0x00000004,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define num rb per shader engine config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum NumRbPerShaderEngineConfig
|
||||
{
|
||||
ADDR_CONFIG_1_RB_PER_SHADER_ENGINE = 0x00000000,
|
||||
ADDR_CONFIG_2_RB_PER_SHADER_ENGINE = 0x00000001,
|
||||
ADDR_CONFIG_4_RB_PER_SHADER_ENGINE = 0x00000002,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define num shader engines config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum NumShaderEnginesConfig
|
||||
{
|
||||
ADDR_CONFIG_1_SHADER_ENGINE = 0x00000000,
|
||||
ADDR_CONFIG_2_SHADER_ENGINE = 0x00000001,
|
||||
ADDR_CONFIG_4_SHADER_ENGINE = 0x00000002,
|
||||
ADDR_CONFIG_8_SHADER_ENGINE = 0x00000003,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define pipe interleave size config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum PipeInterleaveSizeConfig
|
||||
{
|
||||
ADDR_CONFIG_PIPE_INTERLEAVE_256B = 0x00000000,
|
||||
ADDR_CONFIG_PIPE_INTERLEAVE_512B = 0x00000001,
|
||||
ADDR_CONFIG_PIPE_INTERLEAVE_1KB = 0x00000002,
|
||||
ADDR_CONFIG_PIPE_INTERLEAVE_2KB = 0x00000003,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define row size config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum RowSizeConfig
|
||||
{
|
||||
ADDR_CONFIG_1KB_ROW = 0x00000000,
|
||||
ADDR_CONFIG_2KB_ROW = 0x00000001,
|
||||
ADDR_CONFIG_4KB_ROW = 0x00000002,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define bank interleave size config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum BankInterleaveSizeConfig
|
||||
{
|
||||
ADDR_CONFIG_BANK_INTERLEAVE_1 = 0x00000000,
|
||||
ADDR_CONFIG_BANK_INTERLEAVE_2 = 0x00000001,
|
||||
ADDR_CONFIG_BANK_INTERLEAVE_4 = 0x00000002,
|
||||
ADDR_CONFIG_BANK_INTERLEAVE_8 = 0x00000003,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Enums that define engine tile size config
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum ShaderEngineTileSizeConfig
|
||||
{
|
||||
ADDR_CONFIG_SE_TILE_16 = 0x00000000,
|
||||
ADDR_CONFIG_SE_TILE_32 = 0x00000001,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class contains asic independent address lib functionalities
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class Lib : public Object
|
||||
{
|
||||
public:
|
||||
virtual ~Lib();
|
||||
|
||||
static ADDR_E_RETURNCODE Create(
|
||||
const ADDR_CREATE_INPUT* pCreateInfo, ADDR_CREATE_OUTPUT* pCreateOut);
|
||||
|
||||
/// Pair of Create
|
||||
VOID Destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
static Lib* GetLib(ADDR_HANDLE hLib);
|
||||
|
||||
/// Returns AddrLib version (from compiled binary instead include file)
|
||||
UINT_32 GetVersion()
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
/// Returns asic chip family name defined by AddrLib
|
||||
ChipFamily GetChipFamily()
|
||||
{
|
||||
return m_chipFamily;
|
||||
}
|
||||
|
||||
ADDR_E_RETURNCODE Flt32ToDepthPixel(
|
||||
const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn,
|
||||
ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE Flt32ToColorPixel(
|
||||
const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn,
|
||||
ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) const;
|
||||
|
||||
BOOL_32 GetExportNorm(const ELEM_GETEXPORTNORM_INPUT* pIn) const;
|
||||
|
||||
ADDR_E_RETURNCODE GetMaxAlignments(ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE GetMaxMetaAlignments(ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut) const;
|
||||
|
||||
UINT_32 GetBpe(AddrFormat format) const;
|
||||
|
||||
protected:
|
||||
Lib(); // Constructor is protected
|
||||
Lib(const Client* pClient);
|
||||
|
||||
/// Pure virtual function to get max base alignments
|
||||
virtual UINT_32 HwlComputeMaxBaseAlignments() const = 0;
|
||||
|
||||
/// Gets maximum alignements for metadata
|
||||
virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID ValidBaseAlignments(UINT_32 alignment) const
|
||||
{
|
||||
#if DEBUG
|
||||
ADDR_ASSERT(alignment <= m_maxBaseAlign);
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID ValidMetaBaseAlignments(UINT_32 metaAlignment) const
|
||||
{
|
||||
#if DEBUG
|
||||
ADDR_ASSERT(metaAlignment <= m_maxMetaBaseAlign);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Initialization
|
||||
//
|
||||
/// Pure Virtual function for Hwl computing internal global parameters from h/w registers
|
||||
virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn) = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl converting chip family
|
||||
virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision) = 0;
|
||||
|
||||
/// Get equation table pointer and number of equations
|
||||
virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
|
||||
{
|
||||
*ppEquationTable = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Misc helper
|
||||
//
|
||||
static UINT_32 Bits2Number(UINT_32 bitNum, ...);
|
||||
|
||||
static UINT_32 GetNumFragments(UINT_32 numSamples, UINT_32 numFrags)
|
||||
{
|
||||
return (numFrags != 0) ? numFrags : Max(1u, numSamples);
|
||||
}
|
||||
|
||||
/// Returns pointer of ElemLib
|
||||
ElemLib* GetElemLib() const
|
||||
{
|
||||
return m_pElemLib;
|
||||
}
|
||||
|
||||
/// Returns fillSizeFields flag
|
||||
UINT_32 GetFillSizeFieldsFlags() const
|
||||
{
|
||||
return m_configFlags.fillSizeFields;
|
||||
}
|
||||
|
||||
private:
|
||||
// Disallow the copy constructor
|
||||
Lib(const Lib& a);
|
||||
|
||||
// Disallow the assignment operator
|
||||
Lib& operator=(const Lib& a);
|
||||
|
||||
VOID SetChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
|
||||
|
||||
VOID SetMinPitchAlignPixels(UINT_32 minPitchAlignPixels);
|
||||
|
||||
VOID SetMaxAlignments();
|
||||
|
||||
protected:
|
||||
LibClass m_class; ///< Store class type (HWL type)
|
||||
|
||||
ChipFamily m_chipFamily; ///< Chip family translated from the one in atiid.h
|
||||
|
||||
UINT_32 m_chipRevision; ///< Revision id from xxx_id.h
|
||||
|
||||
UINT_32 m_version; ///< Current version
|
||||
|
||||
//
|
||||
// Global parameters
|
||||
//
|
||||
ConfigFlags m_configFlags; ///< Global configuration flags. Note this is setup by
|
||||
/// AddrLib instead of Client except forceLinearAligned
|
||||
|
||||
UINT_32 m_pipes; ///< Number of pipes
|
||||
UINT_32 m_banks; ///< Number of banks
|
||||
/// For r800 this is MC_ARB_RAMCFG.NOOFBANK
|
||||
/// Keep it here to do default parameter calculation
|
||||
|
||||
UINT_32 m_pipeInterleaveBytes;
|
||||
///< Specifies the size of contiguous address space
|
||||
/// within each tiling pipe when making linear
|
||||
/// accesses. (Formerly Group Size)
|
||||
|
||||
UINT_32 m_rowSize; ///< DRAM row size, in bytes
|
||||
|
||||
UINT_32 m_minPitchAlignPixels; ///< Minimum pitch alignment in pixels
|
||||
UINT_32 m_maxSamples; ///< Max numSamples
|
||||
|
||||
UINT_32 m_maxBaseAlign; ///< Max base alignment for data surface
|
||||
UINT_32 m_maxMetaBaseAlign; ///< Max base alignment for metadata
|
||||
|
||||
private:
|
||||
ElemLib* m_pElemLib; ///< Element Lib pointer
|
||||
};
|
||||
|
||||
Lib* SiHwlInit (const Client* pClient);
|
||||
Lib* CiHwlInit (const Client* pClient);
|
||||
Lib* Gfx9HwlInit (const Client* pClient);
|
||||
Lib* Gfx10HwlInit(const Client* pClient);
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,544 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrlib1.h
|
||||
* @brief Contains the Addr::V1::Lib class definition.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ADDR_LIB1_H__
|
||||
#define __ADDR_LIB1_H__
|
||||
|
||||
#include "addrlib.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V1
|
||||
{
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Neutral enums that define bank swap size
|
||||
****************************************************************************************************
|
||||
*/
|
||||
enum SampleSplitSize
|
||||
{
|
||||
ADDR_SAMPLESPLIT_1KB = 1024,
|
||||
ADDR_SAMPLESPLIT_2KB = 2048,
|
||||
ADDR_SAMPLESPLIT_4KB = 4096,
|
||||
ADDR_SAMPLESPLIT_8KB = 8192,
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Flags for AddrTileMode
|
||||
****************************************************************************************************
|
||||
*/
|
||||
struct TileModeFlags
|
||||
{
|
||||
UINT_32 thickness : 4;
|
||||
UINT_32 isLinear : 1;
|
||||
UINT_32 isMicro : 1;
|
||||
UINT_32 isMacro : 1;
|
||||
UINT_32 isMacro3d : 1;
|
||||
UINT_32 isPrt : 1;
|
||||
UINT_32 isPrtNoRotation : 1;
|
||||
UINT_32 isBankSwapped : 1;
|
||||
};
|
||||
|
||||
static const UINT_32 Block64K = 0x10000;
|
||||
static const UINT_32 PrtTileSize = Block64K;
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class contains asic independent address lib functionalities
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class Lib : public Addr::Lib
|
||||
{
|
||||
public:
|
||||
virtual ~Lib();
|
||||
|
||||
static Lib* GetLib(
|
||||
ADDR_HANDLE hLib);
|
||||
|
||||
/// Returns tileIndex support
|
||||
BOOL_32 UseTileIndex(INT_32 index) const
|
||||
{
|
||||
return m_configFlags.useTileIndex && (index != TileIndexInvalid);
|
||||
}
|
||||
|
||||
/// Returns combined swizzle support
|
||||
BOOL_32 UseCombinedSwizzle() const
|
||||
{
|
||||
return m_configFlags.useCombinedSwizzle;
|
||||
}
|
||||
|
||||
//
|
||||
// Interface stubs
|
||||
//
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoord(
|
||||
const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddr(
|
||||
const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSliceTileSwizzle(
|
||||
const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
|
||||
ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ExtractBankPipeSwizzle(
|
||||
const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE CombineBankPipeSwizzle(
|
||||
const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeBaseSwizzle(
|
||||
const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeFmaskInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE ComputeFmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeFmaskCoordFromAddr(
|
||||
const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ConvertTileInfoToHW(
|
||||
const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
|
||||
ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ConvertTileIndex(
|
||||
const ADDR_CONVERT_TILEINDEX_INPUT* pIn,
|
||||
ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE GetMacroModeIndex(
|
||||
const ADDR_GET_MACROMODEINDEX_INPUT* pIn,
|
||||
ADDR_GET_MACROMODEINDEX_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ConvertTileIndex1(
|
||||
const ADDR_CONVERT_TILEINDEX1_INPUT* pIn,
|
||||
ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE GetTileIndex(
|
||||
const ADDR_GET_TILEINDEX_INPUT* pIn,
|
||||
ADDR_GET_TILEINDEX_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeHtileInfo(
|
||||
const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeCmaskInfo(
|
||||
const ADDR_COMPUTE_CMASK_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeDccInfo(
|
||||
const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeHtileAddrFromCoord(
|
||||
const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeCmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
|
||||
const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeCmaskCoordFromAddr(
|
||||
const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputePrtInfo(
|
||||
const ADDR_PRT_INFO_INPUT* pIn,
|
||||
ADDR_PRT_INFO_OUTPUT* pOut) const;
|
||||
protected:
|
||||
Lib(); // Constructor is protected
|
||||
Lib(const Client* pClient);
|
||||
|
||||
/// Pure Virtual function for Hwl computing surface info
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing surface address from coord
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoord(
|
||||
const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing surface coord from address
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceCoordFromAddr(
|
||||
const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing surface tile swizzle
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSliceTileSwizzle(
|
||||
const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
|
||||
ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl extracting bank/pipe swizzle from base256b
|
||||
virtual ADDR_E_RETURNCODE HwlExtractBankPipeSwizzle(
|
||||
const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl combining bank/pipe swizzle
|
||||
virtual ADDR_E_RETURNCODE HwlCombineBankPipeSwizzle(
|
||||
UINT_32 bankSwizzle, UINT_32 pipeSwizzle, ADDR_TILEINFO* pTileInfo,
|
||||
UINT_64 baseAddr, UINT_32* pTileSwizzle) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing base swizzle
|
||||
virtual ADDR_E_RETURNCODE HwlComputeBaseSwizzle(
|
||||
const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing HTILE base align
|
||||
virtual UINT_32 HwlComputeHtileBaseAlign(
|
||||
BOOL_32 isTcCompatible, BOOL_32 isLinear, ADDR_TILEINFO* pTileInfo) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing HTILE bpp
|
||||
virtual UINT_32 HwlComputeHtileBpp(
|
||||
BOOL_32 isWidth8, BOOL_32 isHeight8) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing HTILE bytes
|
||||
virtual UINT_64 HwlComputeHtileBytes(
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 bpp,
|
||||
BOOL_32 isLinear, UINT_32 numSlices, UINT_64* pSliceBytes, UINT_32 baseAlign) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing FMASK info
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut) = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl FMASK address from coord
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl FMASK coord from address
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskCoordFromAddr(
|
||||
const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl convert tile info from real value to HW value
|
||||
virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
|
||||
const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
|
||||
ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl compute mipmap info
|
||||
virtual BOOL_32 HwlComputeMipLevel(
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl compute max cmask blockMax value
|
||||
virtual BOOL_32 HwlGetMaxCmaskBlockMax() const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl compute fmask bits
|
||||
virtual UINT_32 HwlComputeFmaskBits(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
UINT_32* pNumSamples) const = 0;
|
||||
|
||||
/// Virtual function to get index (not pure then no need to implement this in all hwls
|
||||
virtual ADDR_E_RETURNCODE HwlGetTileIndex(
|
||||
const ADDR_GET_TILEINDEX_INPUT* pIn,
|
||||
ADDR_GET_TILEINDEX_OUTPUT* pOut) const
|
||||
{
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
/// Virtual function for Hwl to compute Dcc info
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
|
||||
const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const
|
||||
{
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
/// Virtual function to get cmask address for tc compatible cmask
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const
|
||||
{
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
/// Virtual function to get htile address for tc compatible htile
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
|
||||
const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const
|
||||
{
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
// Compute attributes
|
||||
|
||||
// HTILE
|
||||
UINT_32 ComputeHtileInfo(
|
||||
ADDR_HTILE_FLAGS flags,
|
||||
UINT_32 pitchIn, UINT_32 heightIn, UINT_32 numSlices,
|
||||
BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
|
||||
ADDR_TILEINFO* pTileInfo,
|
||||
UINT_32* pPitchOut, UINT_32* pHeightOut, UINT_64* pHtileBytes,
|
||||
UINT_32* pMacroWidth = NULL, UINT_32* pMacroHeight = NULL,
|
||||
UINT_64* pSliceSize = NULL, UINT_32* pBaseAlign = NULL) const;
|
||||
|
||||
// CMASK
|
||||
ADDR_E_RETURNCODE ComputeCmaskInfo(
|
||||
ADDR_CMASK_FLAGS flags,
|
||||
UINT_32 pitchIn, UINT_32 heightIn, UINT_32 numSlices, BOOL_32 isLinear,
|
||||
ADDR_TILEINFO* pTileInfo, UINT_32* pPitchOut, UINT_32* pHeightOut, UINT_64* pCmaskBytes,
|
||||
UINT_32* pMacroWidth, UINT_32* pMacroHeight, UINT_64* pSliceSize = NULL,
|
||||
UINT_32* pBaseAlign = NULL, UINT_32* pBlockMax = NULL) const;
|
||||
|
||||
virtual VOID HwlComputeTileDataWidthAndHeightLinear(
|
||||
UINT_32* pMacroWidth, UINT_32* pMacroHeight,
|
||||
UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
// CMASK & HTILE addressing
|
||||
virtual UINT_64 HwlComputeXmaskAddrFromCoord(
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 x, UINT_32 y, UINT_32 slice,
|
||||
UINT_32 numSlices, UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8,
|
||||
BOOL_32 isHeight8, ADDR_TILEINFO* pTileInfo,
|
||||
UINT_32* bitPosition) const;
|
||||
|
||||
virtual VOID HwlComputeXmaskCoordFromAddr(
|
||||
UINT_64 addr, UINT_32 bitPosition, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
|
||||
UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
|
||||
ADDR_TILEINFO* pTileInfo, UINT_32* pX, UINT_32* pY, UINT_32* pSlice) const;
|
||||
|
||||
// Surface mipmap
|
||||
VOID ComputeMipLevel(
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
/// Pure Virtual function for Hwl to get macro tiled alignment info
|
||||
virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const = 0;
|
||||
|
||||
virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
|
||||
{
|
||||
// not supported in hwl layer
|
||||
}
|
||||
|
||||
virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
|
||||
{
|
||||
// not supported in hwl layer
|
||||
}
|
||||
|
||||
virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
|
||||
{
|
||||
// not supported in hwl layer
|
||||
}
|
||||
|
||||
AddrTileMode DegradeLargeThickTile(AddrTileMode tileMode, UINT_32 bpp) const;
|
||||
|
||||
VOID PadDimensions(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 padDims, UINT_32 mipLevel,
|
||||
UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32* pHeight, UINT_32 heightAlign,
|
||||
UINT_32* pSlices, UINT_32 sliceAlign) const;
|
||||
|
||||
virtual VOID HwlPadDimensions(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
|
||||
UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32 height, UINT_32 heightAlign) const
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Addressing shared for linear/1D tiling
|
||||
//
|
||||
UINT_64 ComputeSurfaceAddrFromCoordLinear(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
|
||||
UINT_32* pBitPosition) const;
|
||||
|
||||
VOID ComputeSurfaceCoordFromAddrLinear(
|
||||
UINT_64 addr, UINT_32 bitPosition, UINT_32 bpp,
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample) const;
|
||||
|
||||
VOID ComputeSurfaceCoordFromAddrMicroTiled(
|
||||
UINT_64 addr, UINT_32 bitPosition,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
|
||||
AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeMicroTileEquation(
|
||||
UINT_32 bpp, AddrTileMode tileMode,
|
||||
AddrTileType microTileType, ADDR_EQUATION* pEquation) const;
|
||||
|
||||
UINT_32 ComputePixelIndexWithinMicroTile(
|
||||
UINT_32 x, UINT_32 y, UINT_32 z,
|
||||
UINT_32 bpp, AddrTileMode tileMode, AddrTileType microTileType) const;
|
||||
|
||||
/// Pure Virtual function for Hwl computing coord from offset inside micro tile
|
||||
virtual VOID HwlComputePixelCoordFromOffset(
|
||||
UINT_32 offset, UINT_32 bpp, UINT_32 numSamples,
|
||||
AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
|
||||
AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const = 0;
|
||||
|
||||
//
|
||||
// Addressing shared by all
|
||||
//
|
||||
virtual UINT_32 HwlGetPipes(
|
||||
const ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
UINT_32 ComputePipeFromAddr(
|
||||
UINT_64 addr, UINT_32 numPipes) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE ComputePipeEquation(
|
||||
UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY, ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const
|
||||
{
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
/// Pure Virtual function for Hwl computing pipe from coord
|
||||
virtual UINT_32 ComputePipeFromCoord(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice, AddrTileMode tileMode,
|
||||
UINT_32 pipeSwizzle, BOOL_32 flags, ADDR_TILEINFO* pTileInfo) const = 0;
|
||||
|
||||
/// Pure Virtual function for Hwl computing coord Y for 8 pipe cmask/htile
|
||||
virtual UINT_32 HwlComputeXmaskCoordYFrom8Pipe(
|
||||
UINT_32 pipe, UINT_32 x) const = 0;
|
||||
|
||||
//
|
||||
// Misc helper
|
||||
//
|
||||
static const TileModeFlags ModeFlags[ADDR_TM_COUNT];
|
||||
|
||||
static UINT_32 Thickness(
|
||||
AddrTileMode tileMode);
|
||||
|
||||
// Checking tile mode
|
||||
static BOOL_32 IsMacroTiled(AddrTileMode tileMode);
|
||||
static BOOL_32 IsMacro3dTiled(AddrTileMode tileMode);
|
||||
static BOOL_32 IsLinear(AddrTileMode tileMode);
|
||||
static BOOL_32 IsMicroTiled(AddrTileMode tileMode);
|
||||
static BOOL_32 IsPrtTileMode(AddrTileMode tileMode);
|
||||
static BOOL_32 IsPrtNoRotationTileMode(AddrTileMode tileMode);
|
||||
|
||||
/// Return TRUE if tile info is needed
|
||||
BOOL_32 UseTileInfo() const
|
||||
{
|
||||
return !m_configFlags.ignoreTileInfo;
|
||||
}
|
||||
|
||||
/// Adjusts pitch alignment for flipping surface
|
||||
VOID AdjustPitchAlignment(
|
||||
ADDR_SURFACE_FLAGS flags, UINT_32* pPitchAlign) const;
|
||||
|
||||
/// Overwrite tile config according to tile index
|
||||
virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
|
||||
UINT_32 bpp, INT_32 index, INT_32 macroModeIndex,
|
||||
ADDR_TILEINFO* pInfo, AddrTileMode* mode = NULL, AddrTileType* type = NULL) const;
|
||||
|
||||
/// Overwrite macro tile config according to tile index
|
||||
virtual INT_32 HwlComputeMacroModeIndex(
|
||||
INT_32 index, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
|
||||
ADDR_TILEINFO* pTileInfo, AddrTileMode *pTileMode = NULL, AddrTileType *pTileType = NULL
|
||||
) const
|
||||
{
|
||||
return TileIndexNoMacroIndex;
|
||||
}
|
||||
|
||||
/// Pre-handler of 3x pitch (96 bit) adjustment
|
||||
virtual UINT_32 HwlPreHandleBaseLvl3xPitch(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
|
||||
/// Post-handler of 3x pitch adjustment
|
||||
virtual UINT_32 HwlPostHandleBaseLvl3xPitch(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
|
||||
/// Check miplevel after surface adjustment
|
||||
ADDR_E_RETURNCODE PostComputeMipLevel(
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
/// Quad buffer stereo support, has its implementation in ind. layer
|
||||
VOID ComputeQbStereoInfo(
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
/// Pure virutual function to compute stereo bank swizzle for right eye
|
||||
virtual UINT_32 HwlComputeQbStereoRightSwizzle(
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
|
||||
|
||||
VOID OptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
/// Overwrite tile setting to PRT
|
||||
virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
|
||||
{
|
||||
}
|
||||
|
||||
static BOOL_32 DegradeTo1D(
|
||||
UINT_32 width, UINT_32 height,
|
||||
UINT_32 macroTilePitchAlign, UINT_32 macroTileHeightAlign);
|
||||
|
||||
private:
|
||||
// Disallow the copy constructor
|
||||
Lib(const Lib& a);
|
||||
|
||||
// Disallow the assignment operator
|
||||
Lib& operator=(const Lib& a);
|
||||
|
||||
UINT_32 ComputeCmaskBaseAlign(
|
||||
ADDR_CMASK_FLAGS flags, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
UINT_64 ComputeCmaskBytes(
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSlices) const;
|
||||
|
||||
//
|
||||
// CMASK/HTILE shared methods
|
||||
//
|
||||
VOID ComputeTileDataWidthAndHeight(
|
||||
UINT_32 bpp, UINT_32 cacheBits, ADDR_TILEINFO* pTileInfo,
|
||||
UINT_32* pMacroWidth, UINT_32* pMacroHeight) const;
|
||||
|
||||
UINT_32 ComputeXmaskCoordYFromPipe(
|
||||
UINT_32 pipe, UINT_32 x) const;
|
||||
};
|
||||
|
||||
} // V1
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,868 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @file addrlib2.h
|
||||
* @brief Contains the Addr::V2::Lib class definition.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ADDR2_LIB2_H__
|
||||
#define __ADDR2_LIB2_H__
|
||||
|
||||
#include "addrlib.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V2
|
||||
{
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief Flags for SwizzleModeTable
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
struct SwizzleModeFlags
|
||||
{
|
||||
// Swizzle mode
|
||||
UINT_32 isLinear : 1; // Linear
|
||||
|
||||
// Block size
|
||||
UINT_32 is256b : 1; // Block size is 256B
|
||||
UINT_32 is4kb : 1; // Block size is 4KB
|
||||
UINT_32 is64kb : 1; // Block size is 64KB
|
||||
UINT_32 isVar : 1; // Block size is variable
|
||||
|
||||
UINT_32 isZ : 1; // Z order swizzle mode
|
||||
UINT_32 isStd : 1; // Standard swizzle mode
|
||||
UINT_32 isDisp : 1; // Display swizzle mode
|
||||
UINT_32 isRot : 1; // Rotate swizzle mode
|
||||
|
||||
// XOR mode
|
||||
UINT_32 isXor : 1; // XOR after swizzle if set
|
||||
|
||||
UINT_32 isT : 1; // T mode
|
||||
|
||||
UINT_32 isRtOpt : 1; // mode opt for render target
|
||||
|
||||
UINT_32 reserved : 20; // Reserved bits
|
||||
};
|
||||
|
||||
struct Dim2d
|
||||
{
|
||||
UINT_32 w;
|
||||
UINT_32 h;
|
||||
};
|
||||
|
||||
struct Dim3d
|
||||
{
|
||||
UINT_32 w;
|
||||
UINT_32 h;
|
||||
UINT_32 d;
|
||||
};
|
||||
|
||||
// Macro define resource block type
|
||||
enum AddrBlockType
|
||||
{
|
||||
AddrBlockMicro = 0, // Resource uses 256B block
|
||||
AddrBlockThin4KB = 1, // Resource uses thin 4KB block
|
||||
AddrBlockThick4KB = 2, // Resource uses thick 4KB block
|
||||
AddrBlockThin64KB = 3, // Resource uses thin 64KB block
|
||||
AddrBlockThick64KB = 4, // Resource uses thick 64KB block
|
||||
AddrBlockVar = 5, // Resource uses var block, only valid for GFX9
|
||||
AddrBlockLinear = 6, // Resource uses linear swizzle mode
|
||||
|
||||
AddrBlockMaxTiledType = AddrBlockVar + 1,
|
||||
};
|
||||
|
||||
enum AddrSwSet
|
||||
{
|
||||
AddrSwSetZ = 1 << ADDR_SW_Z,
|
||||
AddrSwSetS = 1 << ADDR_SW_S,
|
||||
AddrSwSetD = 1 << ADDR_SW_D,
|
||||
AddrSwSetR = 1 << ADDR_SW_R,
|
||||
|
||||
AddrSwSetAll = AddrSwSetZ | AddrSwSetS | AddrSwSetD | AddrSwSetR,
|
||||
};
|
||||
|
||||
const UINT_32 Size256 = 256u;
|
||||
const UINT_32 Size4K = 4096u;
|
||||
const UINT_32 Size64K = 65536u;
|
||||
|
||||
const UINT_32 Log2Size256 = 8u;
|
||||
const UINT_32 Log2Size4K = 12u;
|
||||
const UINT_32 Log2Size64K = 16u;
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief This class contains asic independent address lib functionalities
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
class Lib : public Addr::Lib
|
||||
{
|
||||
public:
|
||||
virtual ~Lib();
|
||||
|
||||
static Lib* GetLib(
|
||||
ADDR_HANDLE hLib);
|
||||
|
||||
//
|
||||
// Interface stubs
|
||||
//
|
||||
|
||||
// For data surface
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfo(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoord(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddr(
|
||||
const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
// For HTile
|
||||
ADDR_E_RETURNCODE ComputeHtileInfo(
|
||||
const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeHtileAddrFromCoord(
|
||||
const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE ComputeHtileCoordFromAddr(
|
||||
const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut);
|
||||
|
||||
// For CMask
|
||||
ADDR_E_RETURNCODE ComputeCmaskInfo(
|
||||
const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeCmaskAddrFromCoord(
|
||||
const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE ComputeCmaskCoordFromAddr(
|
||||
const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
// For FMask
|
||||
ADDR_E_RETURNCODE ComputeFmaskInfo(
|
||||
const ADDR2_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_FMASK_INFO_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE ComputeFmaskAddrFromCoord(
|
||||
const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeFmaskCoordFromAddr(
|
||||
const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
// For DCC key
|
||||
ADDR_E_RETURNCODE ComputeDccInfo(
|
||||
const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeDccAddrFromCoord(
|
||||
const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
// Misc
|
||||
ADDR_E_RETURNCODE ComputePipeBankXor(
|
||||
const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSlicePipeBankXor(
|
||||
const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSubResourceOffsetForSwizzlePattern(
|
||||
const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut);
|
||||
|
||||
ADDR_E_RETURNCODE Addr2GetPreferredSurfaceSetting(
|
||||
const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
|
||||
ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut) const;
|
||||
|
||||
virtual BOOL_32 IsValidDisplaySwizzleMode(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
protected:
|
||||
Lib(); // Constructor is protected
|
||||
Lib(const Client* pClient);
|
||||
|
||||
static const UINT_32 MaxNumOfBpp = 5;
|
||||
static const UINT_32 MaxNumOfAA = 4;
|
||||
|
||||
static const Dim2d Block256_2d[MaxNumOfBpp];
|
||||
static const Dim3d Block1K_3d[MaxNumOfBpp];
|
||||
|
||||
static const UINT_32 PrtAlignment = 64 * 1024;
|
||||
static const UINT_32 MaxMacroBits = 20;
|
||||
|
||||
static const UINT_32 MaxMipLevels = 16;
|
||||
|
||||
BOOL_32 IsValidSwMode(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
// Don't dereference a reinterpret_cast pointer so as not to break
|
||||
// strict-aliasing rules.
|
||||
UINT_32 mode;
|
||||
memcpy(&mode, &m_swizzleModeTable[swizzleMode], sizeof(UINT_32));
|
||||
return mode != 0;
|
||||
}
|
||||
|
||||
// Checking block size
|
||||
BOOL_32 IsBlock256b(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].is256b;
|
||||
}
|
||||
|
||||
BOOL_32 IsBlock4kb(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].is4kb;
|
||||
}
|
||||
|
||||
BOOL_32 IsBlock64kb(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].is64kb;
|
||||
}
|
||||
|
||||
BOOL_32 IsBlockVariable(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isVar;
|
||||
}
|
||||
|
||||
// Checking swizzle mode
|
||||
BOOL_32 IsLinear(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isLinear;
|
||||
}
|
||||
|
||||
BOOL_32 IsRtOptSwizzle(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isRtOpt;
|
||||
}
|
||||
|
||||
BOOL_32 IsZOrderSwizzle(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isZ;
|
||||
}
|
||||
|
||||
BOOL_32 IsStandardSwizzle(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isStd;
|
||||
}
|
||||
|
||||
BOOL_32 IsDisplaySwizzle(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isDisp;
|
||||
}
|
||||
|
||||
BOOL_32 IsRotateSwizzle(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isRot;
|
||||
}
|
||||
|
||||
BOOL_32 IsStandardSwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return HwlIsStandardSwizzle(resourceType, swizzleMode);
|
||||
}
|
||||
|
||||
BOOL_32 IsDisplaySwizzle(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return HwlIsDisplaySwizzle(resourceType, swizzleMode);
|
||||
}
|
||||
|
||||
BOOL_32 IsXor(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isXor;
|
||||
}
|
||||
|
||||
BOOL_32 IsPrt(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isT;
|
||||
}
|
||||
|
||||
BOOL_32 IsNonPrtXor(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return (IsXor(swizzleMode) && (IsPrt(swizzleMode) == FALSE));
|
||||
}
|
||||
|
||||
// Checking resource type
|
||||
static BOOL_32 IsTex1d(AddrResourceType resourceType)
|
||||
{
|
||||
return (resourceType == ADDR_RSRC_TEX_1D);
|
||||
}
|
||||
|
||||
static BOOL_32 IsTex2d(AddrResourceType resourceType)
|
||||
{
|
||||
return (resourceType == ADDR_RSRC_TEX_2D);
|
||||
}
|
||||
|
||||
static BOOL_32 IsTex3d(AddrResourceType resourceType)
|
||||
{
|
||||
return (resourceType == ADDR_RSRC_TEX_3D);
|
||||
}
|
||||
|
||||
BOOL_32 IsThick(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return HwlIsThick(resourceType, swizzleMode);
|
||||
}
|
||||
|
||||
BOOL_32 IsThin(AddrResourceType resourceType, AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return HwlIsThin(resourceType, swizzleMode);
|
||||
}
|
||||
|
||||
UINT_32 GetBlockSizeLog2(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
UINT_32 blockSizeLog2 = 0;
|
||||
|
||||
if (IsBlock256b(swizzleMode) || IsLinear(swizzleMode))
|
||||
{
|
||||
blockSizeLog2 = 8;
|
||||
}
|
||||
else if (IsBlock4kb(swizzleMode))
|
||||
{
|
||||
blockSizeLog2 = 12;
|
||||
}
|
||||
else if (IsBlock64kb(swizzleMode))
|
||||
{
|
||||
blockSizeLog2 = 16;
|
||||
}
|
||||
else if (IsBlockVariable(swizzleMode) && (m_blockVarSizeLog2 != 0))
|
||||
{
|
||||
blockSizeLog2 = m_blockVarSizeLog2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
}
|
||||
|
||||
return blockSizeLog2;
|
||||
}
|
||||
|
||||
UINT_32 GetBlockSize(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return (1 << GetBlockSizeLog2(swizzleMode));
|
||||
}
|
||||
|
||||
static UINT_32 GetFmaskBpp(UINT_32 sample, UINT_32 frag)
|
||||
{
|
||||
sample = (sample == 0) ? 1 : sample;
|
||||
frag = (frag == 0) ? sample : frag;
|
||||
|
||||
UINT_32 fmaskBpp = QLog2(frag);
|
||||
|
||||
if (sample > frag)
|
||||
{
|
||||
fmaskBpp++;
|
||||
}
|
||||
|
||||
if (fmaskBpp == 3)
|
||||
{
|
||||
fmaskBpp = 4;
|
||||
}
|
||||
|
||||
fmaskBpp = Max(8u, fmaskBpp * sample);
|
||||
|
||||
return fmaskBpp;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsStandardSwizzle(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsDisplaySwizzle(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsThin(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsThick(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileInfo(
|
||||
const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskInfo(
|
||||
const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
|
||||
const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord(
|
||||
const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut)
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
|
||||
const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut)
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
|
||||
const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut)
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
|
||||
const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut)
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeBlock256Equation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeThinEquation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeThickEquation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual UINT_32 HwlGetEquationIndex(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_INVALID_EQUATION_INDEX;
|
||||
}
|
||||
|
||||
UINT_32 GetEquationIndex(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
return HwlGetEquationIndex(pIn, pOut);
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputePipeBankXor(
|
||||
const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
|
||||
const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
|
||||
const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
|
||||
const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
|
||||
ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const
|
||||
{
|
||||
ADDR_NOT_IMPLEMENTED();
|
||||
return ADDR_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
ADDR_E_RETURNCODE ComputeBlock256Equation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeThinEquation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeThickEquation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfoSanityCheck(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfoLinear(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfoTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoordLinear(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoordTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddrLinear(
|
||||
const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceCoordFromAddrTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
UINT_32 ComputeSurface2DMicroBlockOffset(
|
||||
const _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn) const;
|
||||
|
||||
UINT_32 ComputeSurface3DMicroBlockOffset(
|
||||
const _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn) const;
|
||||
|
||||
// Misc
|
||||
ADDR_E_RETURNCODE ComputeBlockDimensionForSurf(
|
||||
UINT_32* pWidth,
|
||||
UINT_32* pHeight,
|
||||
UINT_32* pDepth,
|
||||
UINT_32 bpp,
|
||||
UINT_32 numSamples,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeBlockDimension(
|
||||
UINT_32* pWidth,
|
||||
UINT_32* pHeight,
|
||||
UINT_32* pDepth,
|
||||
UINT_32 bpp,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const;
|
||||
|
||||
virtual VOID ComputeThinBlockDimension(
|
||||
UINT_32* pWidth,
|
||||
UINT_32* pHeight,
|
||||
UINT_32* pDepth,
|
||||
UINT_32 bpp,
|
||||
UINT_32 numSamples,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const;
|
||||
|
||||
VOID ComputeThickBlockDimension(
|
||||
UINT_32* pWidth,
|
||||
UINT_32* pHeight,
|
||||
UINT_32* pDepth,
|
||||
UINT_32 bpp,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const;
|
||||
|
||||
static UINT_64 ComputePadSize(
|
||||
const Dim3d* pBlkDim,
|
||||
UINT_32 width,
|
||||
UINT_32 height,
|
||||
UINT_32 numSlices,
|
||||
Dim3d* pPadDim)
|
||||
{
|
||||
pPadDim->w = PowTwoAlign(width ,pBlkDim->w);
|
||||
pPadDim->h = PowTwoAlign(height ,pBlkDim->h);
|
||||
pPadDim->d = PowTwoAlign(numSlices, pBlkDim->d);
|
||||
return static_cast<UINT_64>(pPadDim->w) * pPadDim->h * pPadDim->d;
|
||||
}
|
||||
|
||||
static ADDR_E_RETURNCODE ExtractPipeBankXor(
|
||||
UINT_32 pipeBankXor,
|
||||
UINT_32 bankBits,
|
||||
UINT_32 pipeBits,
|
||||
UINT_32* pBankX,
|
||||
UINT_32* pPipeX);
|
||||
|
||||
static BOOL_32 Valid3DMipSliceIdConstraint(
|
||||
UINT_32 numSlices,
|
||||
UINT_32 mipId,
|
||||
UINT_32 slice)
|
||||
{
|
||||
return (Max((numSlices >> mipId), 1u) > slice);
|
||||
}
|
||||
|
||||
Dim3d GetMipTailDim(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 blockWidth,
|
||||
UINT_32 blockHeight,
|
||||
UINT_32 blockDepth) const;
|
||||
|
||||
static BOOL_32 IsLocalHeap(AddrResrouceLocation resourceType)
|
||||
{
|
||||
return ((resourceType == ADDR_RSRC_LOC_LOCAL) ||
|
||||
(resourceType == ADDR_RSRC_LOC_INVIS));
|
||||
}
|
||||
|
||||
static BOOL_32 IsInvisibleHeap(AddrResrouceLocation resourceType)
|
||||
{
|
||||
return (resourceType == ADDR_RSRC_LOC_INVIS);
|
||||
}
|
||||
|
||||
static BOOL_32 IsNonlocalHeap(AddrResrouceLocation resourceType)
|
||||
{
|
||||
return ((resourceType == ADDR_RSRC_LOC_USWC) ||
|
||||
(resourceType == ADDR_RSRC_LOC_CACHED));
|
||||
}
|
||||
|
||||
UINT_32 GetPipeLog2ForMetaAddressing(BOOL_32 pipeAligned, AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
UINT_32 numPipeLog2 = pipeAligned ? Min(m_pipesLog2 + m_seLog2, 5u) : 0;
|
||||
|
||||
if (IsXor(swizzleMode))
|
||||
{
|
||||
UINT_32 maxPipeLog2 = GetBlockSizeLog2(swizzleMode) - m_pipeInterleaveLog2;
|
||||
|
||||
numPipeLog2 = Min(numPipeLog2, maxPipeLog2);
|
||||
}
|
||||
|
||||
return numPipeLog2;
|
||||
}
|
||||
|
||||
UINT_32 GetPipeNumForMetaAddressing(BOOL_32 pipeAligned, AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return (1 << GetPipeLog2ForMetaAddressing(pipeAligned, swizzleMode));
|
||||
}
|
||||
|
||||
VOID VerifyMipLevelInfo(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const
|
||||
{
|
||||
#if DEBUG
|
||||
if (pIn->numMipLevels > 1)
|
||||
{
|
||||
UINT_32 actualMipLevels = 1;
|
||||
switch (pIn->resourceType)
|
||||
{
|
||||
case ADDR_RSRC_TEX_3D:
|
||||
// Fall through to share 2D case
|
||||
actualMipLevels = Max(actualMipLevels, Log2NonPow2(pIn->numSlices) + 1);
|
||||
case ADDR_RSRC_TEX_2D:
|
||||
// Fall through to share 1D case
|
||||
actualMipLevels = Max(actualMipLevels, Log2NonPow2(pIn->height) + 1);
|
||||
case ADDR_RSRC_TEX_1D:
|
||||
// Base 1D case
|
||||
actualMipLevels = Max(actualMipLevels, Log2NonPow2(pIn->width) + 1);
|
||||
break;
|
||||
default:
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
}
|
||||
// Client pass wrong number of MipLevels to addrlib and result will be bad.
|
||||
// Not sure if we should fail this calling instead of putting an assertion here.
|
||||
ADDR_ASSERT(actualMipLevels >= pIn->numMipLevels);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ADDR_E_RETURNCODE ApplyCustomerPipeBankXor(
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 pipeBankXor,
|
||||
UINT_32 bankBits,
|
||||
UINT_32 pipeBits,
|
||||
UINT_32* pBlockOffset) const
|
||||
{
|
||||
ADDR_E_RETURNCODE returnCode = ADDR_OK;
|
||||
|
||||
if (IsXor(swizzleMode))
|
||||
{
|
||||
// Apply driver set bankPipeXor
|
||||
UINT_32 bankX = 0;
|
||||
UINT_32 pipeX = 0;
|
||||
returnCode = ExtractPipeBankXor(pipeBankXor, bankBits, pipeBits, &bankX, &pipeX);
|
||||
*pBlockOffset ^= (pipeX << m_pipeInterleaveLog2);
|
||||
*pBlockOffset ^= (bankX << (m_pipeInterleaveLog2 + pipeBits));
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
UINT_32 GetPipeXorBits(UINT_32 macroBlockBits) const;
|
||||
|
||||
ADDR_E_RETURNCODE ApplyCustomizedPitchHeight(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
UINT_32 elementBytes,
|
||||
UINT_32 pitchAlignInElement,
|
||||
UINT_32* pPitch,
|
||||
UINT_32* pHeight) const;
|
||||
|
||||
VOID ComputeQbStereoInfo(ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
VOID FilterInvalidEqSwizzleMode(
|
||||
ADDR2_SWMODE_SET& allowedSwModeSet,
|
||||
AddrResourceType resourceType,
|
||||
UINT_32 elemLog2) const;
|
||||
|
||||
UINT_32 m_se; ///< Number of shader engine
|
||||
UINT_32 m_rbPerSe; ///< Number of render backend per shader engine
|
||||
UINT_32 m_maxCompFrag; ///< Number of max compressed fragment
|
||||
|
||||
UINT_32 m_banksLog2; ///< Number of bank Log2
|
||||
UINT_32 m_pipesLog2; ///< Number of pipe per shader engine Log2
|
||||
UINT_32 m_seLog2; ///< Number of shader engine Log2
|
||||
UINT_32 m_rbPerSeLog2; ///< Number of render backend per shader engine Log2
|
||||
UINT_32 m_maxCompFragLog2; ///< Number of max compressed fragment Log2
|
||||
|
||||
UINT_32 m_pipeInterleaveLog2; ///< Log2 of pipe interleave bytes
|
||||
|
||||
UINT_32 m_blockVarSizeLog2; ///< Log2 of block var size
|
||||
|
||||
SwizzleModeFlags m_swizzleModeTable[ADDR_SW_MAX_TYPE]; ///< Swizzle mode table
|
||||
|
||||
// Max number of swizzle mode supported for equation
|
||||
static const UINT_32 MaxSwModeType = 32;
|
||||
// Max number of resource type (2D/3D) supported for equation
|
||||
static const UINT_32 MaxRsrcType = 2;
|
||||
// Max number of bpp (8bpp/16bpp/32bpp/64bpp/128bpp)
|
||||
static const UINT_32 MaxElementBytesLog2 = 5;
|
||||
// Almost all swizzle mode + resource type support equation
|
||||
static const UINT_32 EquationTableSize = MaxElementBytesLog2 * MaxSwModeType * MaxRsrcType;
|
||||
// Equation table
|
||||
ADDR_EQUATION m_equationTable[EquationTableSize];
|
||||
|
||||
// Number of equation entries in the table
|
||||
UINT_32 m_numEquations;
|
||||
// Equation lookup table according to bpp and tile index
|
||||
UINT_32 m_equationLookupTable[MaxRsrcType][MaxSwModeType][MaxElementBytesLog2];
|
||||
|
||||
private:
|
||||
// Disallow the copy constructor
|
||||
Lib(const Lib& a);
|
||||
|
||||
// Disallow the assignment operator
|
||||
Lib& operator=(const Lib& a);
|
||||
};
|
||||
|
||||
} // V2
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrobject.cpp
|
||||
* @brief Contains the Object base class implementation.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#include "addrinterface.h"
|
||||
#include "addrobject.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::Object
|
||||
*
|
||||
* @brief
|
||||
* Constructor for the Object class.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Object::Object()
|
||||
{
|
||||
m_client.handle = NULL;
|
||||
m_client.callbacks.allocSysMem = NULL;
|
||||
m_client.callbacks.freeSysMem = NULL;
|
||||
m_client.callbacks.debugPrint = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::Object
|
||||
*
|
||||
* @brief
|
||||
* Constructor for the Object class.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Object::Object(const Client* pClient)
|
||||
{
|
||||
m_client = *pClient;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::~Object
|
||||
*
|
||||
* @brief
|
||||
* Destructor for the Object class.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
Object::~Object()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::ClientAlloc
|
||||
*
|
||||
* @brief
|
||||
* Calls instanced allocSysMem inside Client
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID* Object::ClientAlloc(
|
||||
size_t objSize, ///< [in] Size to allocate
|
||||
const Client* pClient) ///< [in] Client pointer
|
||||
{
|
||||
VOID* pObjMem = NULL;
|
||||
|
||||
if (pClient->callbacks.allocSysMem != NULL)
|
||||
{
|
||||
ADDR_ALLOCSYSMEM_INPUT allocInput = {0};
|
||||
|
||||
allocInput.size = sizeof(ADDR_ALLOCSYSMEM_INPUT);
|
||||
allocInput.flags.value = 0;
|
||||
allocInput.sizeInBytes = static_cast<UINT_32>(objSize);
|
||||
allocInput.hClient = pClient->handle;
|
||||
|
||||
pObjMem = pClient->callbacks.allocSysMem(&allocInput);
|
||||
}
|
||||
|
||||
return pObjMem;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::Alloc
|
||||
*
|
||||
* @brief
|
||||
* A wrapper of ClientAlloc
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID* Object::Alloc(
|
||||
size_t objSize ///< [in] Size to allocate
|
||||
) const
|
||||
{
|
||||
return ClientAlloc(objSize, &m_client);;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::ClientFree
|
||||
*
|
||||
* @brief
|
||||
* Calls freeSysMem inside Client
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Object::ClientFree(
|
||||
VOID* pObjMem, ///< [in] User virtual address to free.
|
||||
const Client* pClient) ///< [in] Client pointer
|
||||
{
|
||||
if (pClient->callbacks.freeSysMem != NULL)
|
||||
{
|
||||
if (pObjMem != NULL)
|
||||
{
|
||||
ADDR_FREESYSMEM_INPUT freeInput = {0};
|
||||
|
||||
freeInput.size = sizeof(ADDR_FREESYSMEM_INPUT);
|
||||
freeInput.hClient = pClient->handle;
|
||||
freeInput.pVirtAddr = pObjMem;
|
||||
|
||||
pClient->callbacks.freeSysMem(&freeInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::Free
|
||||
*
|
||||
* @brief
|
||||
* A wrapper of ClientFree
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Object::Free(
|
||||
VOID* pObjMem ///< [in] User virtual address to free.
|
||||
) const
|
||||
{
|
||||
ClientFree(pObjMem, &m_client);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::operator new
|
||||
*
|
||||
* @brief
|
||||
* Placement new operator. (with pre-allocated memory pointer)
|
||||
*
|
||||
* @return
|
||||
* Returns pre-allocated memory pointer.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID* Object::operator new(
|
||||
size_t objSize, ///< [in] Size to allocate
|
||||
VOID* pMem) ///< [in] Pre-allocated pointer
|
||||
{
|
||||
return pMem;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::operator delete
|
||||
*
|
||||
* @brief
|
||||
* Frees Object object memory.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Object::operator delete(
|
||||
VOID* pObjMem) ///< [in] User virtual address to free.
|
||||
{
|
||||
Object* pObj = static_cast<Object*>(pObjMem);
|
||||
ClientFree(pObjMem, &pObj->m_client);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* Object::DebugPrint
|
||||
*
|
||||
* @brief
|
||||
* Print debug message
|
||||
*
|
||||
* @return
|
||||
* N/A
|
||||
****************************************************************************************************
|
||||
*/
|
||||
VOID Object::DebugPrint(
|
||||
const CHAR* pDebugString, ///< [in] Debug string
|
||||
...
|
||||
) const
|
||||
{
|
||||
#if DEBUG
|
||||
if (m_client.callbacks.debugPrint != NULL)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, pDebugString);
|
||||
|
||||
ADDR_DEBUGPRINT_INPUT debugPrintInput = {0};
|
||||
|
||||
debugPrintInput.size = sizeof(ADDR_DEBUGPRINT_INPUT);
|
||||
debugPrintInput.pDebugString = const_cast<CHAR*>(pDebugString);
|
||||
debugPrintInput.hClient = m_client.handle;
|
||||
va_copy(debugPrintInput.ap, ap);
|
||||
|
||||
m_client.callbacks.debugPrint(&debugPrintInput);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // Addr
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file addrobject.h
|
||||
* @brief Contains the Object base class definition.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ADDR_OBJECT_H__
|
||||
#define __ADDR_OBJECT_H__
|
||||
|
||||
#include "addrtypes.h"
|
||||
#include "addrcommon.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This structure contains client specific data
|
||||
****************************************************************************************************
|
||||
*/
|
||||
struct Client
|
||||
{
|
||||
ADDR_CLIENT_HANDLE handle;
|
||||
ADDR_CALLBACKS callbacks;
|
||||
};
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class is the base class for all ADDR class objects.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
Object();
|
||||
Object(const Client* pClient);
|
||||
virtual ~Object();
|
||||
|
||||
VOID* operator new(size_t size, VOID* pMem);
|
||||
VOID operator delete(VOID* pObj);
|
||||
/// Microsoft compiler requires a matching delete implementation, which seems to be called when
|
||||
/// bad_alloc is thrown. But currently C++ exception isn't allowed so a dummy implementation is
|
||||
/// added to eliminate the warning.
|
||||
VOID operator delete(VOID* pObj, VOID* pMem) { ADDR_ASSERT_ALWAYS(); }
|
||||
|
||||
VOID* Alloc(size_t size) const;
|
||||
VOID Free(VOID* pObj) const;
|
||||
|
||||
VOID DebugPrint(const CHAR* pDebugString, ...) const;
|
||||
|
||||
const Client* GetClient() const {return &m_client;}
|
||||
|
||||
protected:
|
||||
Client m_client;
|
||||
|
||||
static VOID* ClientAlloc(size_t size, const Client* pClient);
|
||||
static VOID ClientFree(VOID* pObj, const Client* pClient);
|
||||
|
||||
private:
|
||||
// disallow the copy constructor
|
||||
Object(const Object& a);
|
||||
|
||||
// disallow the assignment operator
|
||||
Object& operator=(const Object& a);
|
||||
};
|
||||
|
||||
} // Addr
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,715 @@
|
||||
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
// Coordinate class implementation
|
||||
#include "addrcommon.h"
|
||||
#include "coord.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V2
|
||||
{
|
||||
|
||||
Coordinate::Coordinate()
|
||||
{
|
||||
dim = 'x';
|
||||
ord = 0;
|
||||
}
|
||||
|
||||
Coordinate::Coordinate(INT_8 c, INT_32 n)
|
||||
{
|
||||
set(c, n);
|
||||
}
|
||||
|
||||
VOID Coordinate::set(INT_8 c, INT_32 n)
|
||||
{
|
||||
dim = c;
|
||||
ord = static_cast<INT_8>(n);
|
||||
}
|
||||
|
||||
UINT_32 Coordinate::ison(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
|
||||
{
|
||||
UINT_32 bit = static_cast<UINT_32>(1ull << static_cast<UINT_32>(ord));
|
||||
UINT_32 out = 0;
|
||||
|
||||
switch (dim)
|
||||
{
|
||||
case 'm': out = m & bit; break;
|
||||
case 's': out = s & bit; break;
|
||||
case 'x': out = x & bit; break;
|
||||
case 'y': out = y & bit; break;
|
||||
case 'z': out = z & bit; break;
|
||||
}
|
||||
return (out != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
INT_8 Coordinate::getdim()
|
||||
{
|
||||
return dim;
|
||||
}
|
||||
|
||||
INT_8 Coordinate::getord()
|
||||
{
|
||||
return ord;
|
||||
}
|
||||
|
||||
BOOL_32 Coordinate::operator==(const Coordinate& b)
|
||||
{
|
||||
return (dim == b.dim) && (ord == b.ord);
|
||||
}
|
||||
|
||||
BOOL_32 Coordinate::operator<(const Coordinate& b)
|
||||
{
|
||||
BOOL_32 ret;
|
||||
|
||||
if (dim == b.dim)
|
||||
{
|
||||
ret = ord < b.ord;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dim == 's' || b.dim == 'm')
|
||||
{
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (b.dim == 's' || dim == 'm')
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
else if (ord == b.ord)
|
||||
{
|
||||
ret = dim < b.dim;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ord < b.ord;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL_32 Coordinate::operator>(const Coordinate& b)
|
||||
{
|
||||
BOOL_32 lt = *this < b;
|
||||
BOOL_32 eq = *this == b;
|
||||
return !lt && !eq;
|
||||
}
|
||||
|
||||
BOOL_32 Coordinate::operator<=(const Coordinate& b)
|
||||
{
|
||||
return (*this < b) || (*this == b);
|
||||
}
|
||||
|
||||
BOOL_32 Coordinate::operator>=(const Coordinate& b)
|
||||
{
|
||||
return !(*this < b);
|
||||
}
|
||||
|
||||
BOOL_32 Coordinate::operator!=(const Coordinate& b)
|
||||
{
|
||||
return !(*this == b);
|
||||
}
|
||||
|
||||
Coordinate& Coordinate::operator++(INT_32)
|
||||
{
|
||||
ord++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// CoordTerm
|
||||
|
||||
CoordTerm::CoordTerm()
|
||||
{
|
||||
num_coords = 0;
|
||||
}
|
||||
|
||||
VOID CoordTerm::Clear()
|
||||
{
|
||||
num_coords = 0;
|
||||
}
|
||||
|
||||
VOID CoordTerm::add(Coordinate& co)
|
||||
{
|
||||
// This function adds a coordinate INT_32o the list
|
||||
// It will prevent the same coordinate from appearing,
|
||||
// and will keep the list ordered from smallest to largest
|
||||
UINT_32 i;
|
||||
|
||||
for (i = 0; i < num_coords; i++)
|
||||
{
|
||||
if (m_coord[i] == co)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (m_coord[i] > co)
|
||||
{
|
||||
for (UINT_32 j = num_coords; j > i; j--)
|
||||
{
|
||||
m_coord[j] = m_coord[j - 1];
|
||||
}
|
||||
m_coord[i] = co;
|
||||
num_coords++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == num_coords)
|
||||
{
|
||||
m_coord[num_coords] = co;
|
||||
num_coords++;
|
||||
}
|
||||
}
|
||||
|
||||
VOID CoordTerm::add(CoordTerm& cl)
|
||||
{
|
||||
for (UINT_32 i = 0; i < cl.num_coords; i++)
|
||||
{
|
||||
add(cl.m_coord[i]);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL_32 CoordTerm::remove(Coordinate& co)
|
||||
{
|
||||
BOOL_32 remove = FALSE;
|
||||
for (UINT_32 i = 0; i < num_coords; i++)
|
||||
{
|
||||
if (m_coord[i] == co)
|
||||
{
|
||||
remove = TRUE;
|
||||
num_coords--;
|
||||
}
|
||||
|
||||
if (remove)
|
||||
{
|
||||
m_coord[i] = m_coord[i + 1];
|
||||
}
|
||||
}
|
||||
return remove;
|
||||
}
|
||||
|
||||
BOOL_32 CoordTerm::Exists(Coordinate& co)
|
||||
{
|
||||
BOOL_32 exists = FALSE;
|
||||
for (UINT_32 i = 0; i < num_coords; i++)
|
||||
{
|
||||
if (m_coord[i] == co)
|
||||
{
|
||||
exists = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return exists;
|
||||
}
|
||||
|
||||
VOID CoordTerm::copyto(CoordTerm& cl)
|
||||
{
|
||||
cl.num_coords = num_coords;
|
||||
for (UINT_32 i = 0; i < num_coords; i++)
|
||||
{
|
||||
cl.m_coord[i] = m_coord[i];
|
||||
}
|
||||
}
|
||||
|
||||
UINT_32 CoordTerm::getsize()
|
||||
{
|
||||
return num_coords;
|
||||
}
|
||||
|
||||
UINT_32 CoordTerm::getxor(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
|
||||
{
|
||||
UINT_32 out = 0;
|
||||
for (UINT_32 i = 0; i < num_coords; i++)
|
||||
{
|
||||
out = out ^ m_coord[i].ison(x, y, z, s, m);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
VOID CoordTerm::getsmallest(Coordinate& co)
|
||||
{
|
||||
co = m_coord[0];
|
||||
}
|
||||
|
||||
UINT_32 CoordTerm::Filter(INT_8 f, Coordinate& co, UINT_32 start, INT_8 axis)
|
||||
{
|
||||
for (UINT_32 i = start; i < num_coords;)
|
||||
{
|
||||
if (((f == '<' && m_coord[i] < co) ||
|
||||
(f == '>' && m_coord[i] > co) ||
|
||||
(f == '=' && m_coord[i] == co)) &&
|
||||
(axis == '\0' || axis == m_coord[i].getdim()))
|
||||
{
|
||||
for (UINT_32 j = i; j < num_coords - 1; j++)
|
||||
{
|
||||
m_coord[j] = m_coord[j + 1];
|
||||
}
|
||||
num_coords--;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return num_coords;
|
||||
}
|
||||
|
||||
Coordinate& CoordTerm::operator[](UINT_32 i)
|
||||
{
|
||||
return m_coord[i];
|
||||
}
|
||||
|
||||
BOOL_32 CoordTerm::operator==(const CoordTerm& b)
|
||||
{
|
||||
BOOL_32 ret = TRUE;
|
||||
|
||||
if (num_coords != b.num_coords)
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UINT_32 i = 0; i < num_coords; i++)
|
||||
{
|
||||
// Note: the lists will always be in order, so we can compare the two lists at time
|
||||
if (m_coord[i] != b.m_coord[i])
|
||||
{
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL_32 CoordTerm::operator!=(const CoordTerm& b)
|
||||
{
|
||||
return !(*this == b);
|
||||
}
|
||||
|
||||
BOOL_32 CoordTerm::exceedRange(UINT_32 xRange, UINT_32 yRange, UINT_32 zRange, UINT_32 sRange)
|
||||
{
|
||||
BOOL_32 exceed = FALSE;
|
||||
for (UINT_32 i = 0; (i < num_coords) && (exceed == FALSE); i++)
|
||||
{
|
||||
UINT_32 subject;
|
||||
switch (m_coord[i].getdim())
|
||||
{
|
||||
case 'x':
|
||||
subject = xRange;
|
||||
break;
|
||||
case 'y':
|
||||
subject = yRange;
|
||||
break;
|
||||
case 'z':
|
||||
subject = zRange;
|
||||
break;
|
||||
case 's':
|
||||
subject = sRange;
|
||||
break;
|
||||
case 'm':
|
||||
subject = 0;
|
||||
break;
|
||||
default:
|
||||
// Invalid input!
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
subject = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
exceed = ((1u << m_coord[i].getord()) <= subject);
|
||||
}
|
||||
|
||||
return exceed;
|
||||
}
|
||||
|
||||
// coordeq
|
||||
CoordEq::CoordEq()
|
||||
{
|
||||
m_numBits = 0;
|
||||
}
|
||||
|
||||
VOID CoordEq::remove(Coordinate& co)
|
||||
{
|
||||
for (UINT_32 i = 0; i < m_numBits; i++)
|
||||
{
|
||||
m_eq[i].remove(co);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL_32 CoordEq::Exists(Coordinate& co)
|
||||
{
|
||||
BOOL_32 exists = FALSE;
|
||||
|
||||
for (UINT_32 i = 0; i < m_numBits; i++)
|
||||
{
|
||||
if (m_eq[i].Exists(co))
|
||||
{
|
||||
exists = TRUE;
|
||||
}
|
||||
}
|
||||
return exists;
|
||||
}
|
||||
|
||||
VOID CoordEq::resize(UINT_32 n)
|
||||
{
|
||||
if (n > m_numBits)
|
||||
{
|
||||
for (UINT_32 i = m_numBits; i < n; i++)
|
||||
{
|
||||
m_eq[i].Clear();
|
||||
}
|
||||
}
|
||||
m_numBits = n;
|
||||
}
|
||||
|
||||
UINT_32 CoordEq::getsize()
|
||||
{
|
||||
return m_numBits;
|
||||
}
|
||||
|
||||
UINT_64 CoordEq::solve(UINT_32 x, UINT_32 y, UINT_32 z, UINT_32 s, UINT_32 m) const
|
||||
{
|
||||
UINT_64 out = 0;
|
||||
for (UINT_32 i = 0; i < m_numBits; i++)
|
||||
{
|
||||
if (m_eq[i].getxor(x, y, z, s, m) != 0)
|
||||
{
|
||||
out |= (1ULL << i);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
VOID CoordEq::solveAddr(
|
||||
UINT_64 addr, UINT_32 sliceInM,
|
||||
UINT_32& x, UINT_32& y, UINT_32& z, UINT_32& s, UINT_32& m) const
|
||||
{
|
||||
UINT_32 xBitsValid = 0;
|
||||
UINT_32 yBitsValid = 0;
|
||||
UINT_32 zBitsValid = 0;
|
||||
UINT_32 sBitsValid = 0;
|
||||
UINT_32 mBitsValid = 0;
|
||||
|
||||
CoordEq temp = *this;
|
||||
|
||||
x = y = z = s = m = 0;
|
||||
|
||||
UINT_32 bitsLeft = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < temp.m_numBits; i++)
|
||||
{
|
||||
UINT_32 termSize = temp.m_eq[i].getsize();
|
||||
|
||||
if (termSize == 1)
|
||||
{
|
||||
INT_8 bit = (addr >> i) & 1;
|
||||
INT_8 dim = temp.m_eq[i][0].getdim();
|
||||
INT_8 ord = temp.m_eq[i][0].getord();
|
||||
|
||||
ADDR_ASSERT((ord < 32) || (bit == 0));
|
||||
|
||||
switch (dim)
|
||||
{
|
||||
case 'x':
|
||||
xBitsValid |= (1 << ord);
|
||||
x |= (bit << ord);
|
||||
break;
|
||||
case 'y':
|
||||
yBitsValid |= (1 << ord);
|
||||
y |= (bit << ord);
|
||||
break;
|
||||
case 'z':
|
||||
zBitsValid |= (1 << ord);
|
||||
z |= (bit << ord);
|
||||
break;
|
||||
case 's':
|
||||
sBitsValid |= (1 << ord);
|
||||
s |= (bit << ord);
|
||||
break;
|
||||
case 'm':
|
||||
mBitsValid |= (1 << ord);
|
||||
m |= (bit << ord);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
temp.m_eq[i].Clear();
|
||||
}
|
||||
else if (termSize > 1)
|
||||
{
|
||||
bitsLeft++;
|
||||
}
|
||||
}
|
||||
|
||||
if (bitsLeft > 0)
|
||||
{
|
||||
if (sliceInM != 0)
|
||||
{
|
||||
z = m / sliceInM;
|
||||
zBitsValid = 0xffffffff;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
bitsLeft = 0;
|
||||
|
||||
for (UINT_32 i = 0; i < temp.m_numBits; i++)
|
||||
{
|
||||
UINT_32 termSize = temp.m_eq[i].getsize();
|
||||
|
||||
if (termSize == 1)
|
||||
{
|
||||
INT_8 bit = (addr >> i) & 1;
|
||||
INT_8 dim = temp.m_eq[i][0].getdim();
|
||||
INT_8 ord = temp.m_eq[i][0].getord();
|
||||
|
||||
ADDR_ASSERT((ord < 32) || (bit == 0));
|
||||
|
||||
switch (dim)
|
||||
{
|
||||
case 'x':
|
||||
xBitsValid |= (1 << ord);
|
||||
x |= (bit << ord);
|
||||
break;
|
||||
case 'y':
|
||||
yBitsValid |= (1 << ord);
|
||||
y |= (bit << ord);
|
||||
break;
|
||||
case 'z':
|
||||
zBitsValid |= (1 << ord);
|
||||
z |= (bit << ord);
|
||||
break;
|
||||
case 's':
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
case 'm':
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
temp.m_eq[i].Clear();
|
||||
}
|
||||
else if (termSize > 1)
|
||||
{
|
||||
CoordTerm tmpTerm = temp.m_eq[i];
|
||||
|
||||
for (UINT_32 j = 0; j < termSize; j++)
|
||||
{
|
||||
INT_8 dim = temp.m_eq[i][j].getdim();
|
||||
INT_8 ord = temp.m_eq[i][j].getord();
|
||||
|
||||
switch (dim)
|
||||
{
|
||||
case 'x':
|
||||
if (xBitsValid & (1 << ord))
|
||||
{
|
||||
UINT_32 v = (((x >> ord) & 1) << i);
|
||||
addr ^= static_cast<UINT_64>(v);
|
||||
tmpTerm.remove(temp.m_eq[i][j]);
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
if (yBitsValid & (1 << ord))
|
||||
{
|
||||
UINT_32 v = (((y >> ord) & 1) << i);
|
||||
addr ^= static_cast<UINT_64>(v);
|
||||
tmpTerm.remove(temp.m_eq[i][j]);
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
if (zBitsValid & (1 << ord))
|
||||
{
|
||||
UINT_32 v = (((z >> ord) & 1) << i);
|
||||
addr ^= static_cast<UINT_64>(v);
|
||||
tmpTerm.remove(temp.m_eq[i][j]);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
case 'm':
|
||||
ADDR_ASSERT_ALWAYS();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
temp.m_eq[i] = tmpTerm;
|
||||
|
||||
bitsLeft++;
|
||||
}
|
||||
}
|
||||
} while (bitsLeft > 0);
|
||||
}
|
||||
}
|
||||
|
||||
VOID CoordEq::copy(CoordEq& o, UINT_32 start, UINT_32 num)
|
||||
{
|
||||
o.m_numBits = (num == 0xFFFFFFFF) ? m_numBits : num;
|
||||
for (UINT_32 i = 0; i < o.m_numBits; i++)
|
||||
{
|
||||
m_eq[start + i].copyto(o.m_eq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
VOID CoordEq::reverse(UINT_32 start, UINT_32 num)
|
||||
{
|
||||
UINT_32 n = (num == 0xFFFFFFFF) ? m_numBits : num;
|
||||
|
||||
for (UINT_32 i = 0; i < n / 2; i++)
|
||||
{
|
||||
CoordTerm temp;
|
||||
m_eq[start + i].copyto(temp);
|
||||
m_eq[start + n - 1 - i].copyto(m_eq[start + i]);
|
||||
temp.copyto(m_eq[start + n - 1 - i]);
|
||||
}
|
||||
}
|
||||
|
||||
VOID CoordEq::xorin(CoordEq& x, UINT_32 start)
|
||||
{
|
||||
UINT_32 n = ((m_numBits - start) < x.m_numBits) ? (m_numBits - start) : x.m_numBits;
|
||||
for (UINT_32 i = 0; i < n; i++)
|
||||
{
|
||||
m_eq[start + i].add(x.m_eq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
UINT_32 CoordEq::Filter(INT_8 f, Coordinate& co, UINT_32 start, INT_8 axis)
|
||||
{
|
||||
for (UINT_32 i = start; i < m_numBits;)
|
||||
{
|
||||
UINT_32 m = m_eq[i].Filter(f, co, 0, axis);
|
||||
if (m == 0)
|
||||
{
|
||||
for (UINT_32 j = i; j < m_numBits - 1; j++)
|
||||
{
|
||||
m_eq[j] = m_eq[j + 1];
|
||||
}
|
||||
m_numBits--;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return m_numBits;
|
||||
}
|
||||
|
||||
VOID CoordEq::shift(INT_32 amount, INT_32 start)
|
||||
{
|
||||
if (amount != 0)
|
||||
{
|
||||
INT_32 numBits = static_cast<INT_32>(m_numBits);
|
||||
amount = -amount;
|
||||
INT_32 inc = (amount < 0) ? -1 : 1;
|
||||
INT_32 i = (amount < 0) ? numBits - 1 : start;
|
||||
INT_32 end = (amount < 0) ? start - 1 : numBits;
|
||||
for (; (inc > 0) ? i < end : i > end; i += inc)
|
||||
{
|
||||
if ((i + amount < start) || (i + amount >= numBits))
|
||||
{
|
||||
m_eq[i].Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eq[i + amount].copyto(m_eq[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoordTerm& CoordEq::operator[](UINT_32 i)
|
||||
{
|
||||
return m_eq[i];
|
||||
}
|
||||
|
||||
VOID CoordEq::mort2d(Coordinate& c0, Coordinate& c1, UINT_32 start, UINT_32 end)
|
||||
{
|
||||
if (end == 0)
|
||||
{
|
||||
ADDR_ASSERT(m_numBits > 0);
|
||||
end = m_numBits - 1;
|
||||
}
|
||||
for (UINT_32 i = start; i <= end; i++)
|
||||
{
|
||||
UINT_32 select = (i - start) % 2;
|
||||
Coordinate& c = (select == 0) ? c0 : c1;
|
||||
m_eq[i].add(c);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
VOID CoordEq::mort3d(Coordinate& c0, Coordinate& c1, Coordinate& c2, UINT_32 start, UINT_32 end)
|
||||
{
|
||||
if (end == 0)
|
||||
{
|
||||
ADDR_ASSERT(m_numBits > 0);
|
||||
end = m_numBits - 1;
|
||||
}
|
||||
for (UINT_32 i = start; i <= end; i++)
|
||||
{
|
||||
UINT_32 select = (i - start) % 3;
|
||||
Coordinate& c = (select == 0) ? c0 : ((select == 1) ? c1 : c2);
|
||||
m_eq[i].add(c);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL_32 CoordEq::operator==(const CoordEq& b)
|
||||
{
|
||||
BOOL_32 ret = TRUE;
|
||||
|
||||
if (m_numBits != b.m_numBits)
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UINT_32 i = 0; i < m_numBits; i++)
|
||||
{
|
||||
if (m_eq[i] != b.m_eq[i])
|
||||
{
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL_32 CoordEq::operator!=(const CoordEq& b)
|
||||
{
|
||||
return !(*this == b);
|
||||
}
|
||||
|
||||
} // V2
|
||||
} // Addr
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
// Class used to define a coordinate bit
|
||||
|
||||
#ifndef __COORD_H
|
||||
#define __COORD_H
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V2
|
||||
{
|
||||
|
||||
class Coordinate
|
||||
{
|
||||
public:
|
||||
Coordinate();
|
||||
Coordinate(INT_8 c, INT_32 n);
|
||||
|
||||
VOID set(INT_8 c, INT_32 n);
|
||||
UINT_32 ison(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
|
||||
INT_8 getdim();
|
||||
INT_8 getord();
|
||||
|
||||
BOOL_32 operator==(const Coordinate& b);
|
||||
BOOL_32 operator<(const Coordinate& b);
|
||||
BOOL_32 operator>(const Coordinate& b);
|
||||
BOOL_32 operator<=(const Coordinate& b);
|
||||
BOOL_32 operator>=(const Coordinate& b);
|
||||
BOOL_32 operator!=(const Coordinate& b);
|
||||
Coordinate& operator++(INT_32);
|
||||
|
||||
private:
|
||||
INT_8 dim;
|
||||
INT_8 ord;
|
||||
};
|
||||
|
||||
class CoordTerm
|
||||
{
|
||||
public:
|
||||
CoordTerm();
|
||||
VOID Clear();
|
||||
VOID add(Coordinate& co);
|
||||
VOID add(CoordTerm& cl);
|
||||
BOOL_32 remove(Coordinate& co);
|
||||
BOOL_32 Exists(Coordinate& co);
|
||||
VOID copyto(CoordTerm& cl);
|
||||
UINT_32 getsize();
|
||||
UINT_32 getxor(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
|
||||
|
||||
VOID getsmallest(Coordinate& co);
|
||||
UINT_32 Filter(INT_8 f, Coordinate& co, UINT_32 start = 0, INT_8 axis = '\0');
|
||||
Coordinate& operator[](UINT_32 i);
|
||||
BOOL_32 operator==(const CoordTerm& b);
|
||||
BOOL_32 operator!=(const CoordTerm& b);
|
||||
BOOL_32 exceedRange(UINT_32 xRange, UINT_32 yRange = 0, UINT_32 zRange = 0, UINT_32 sRange = 0);
|
||||
|
||||
private:
|
||||
static const UINT_32 MaxCoords = 8;
|
||||
UINT_32 num_coords;
|
||||
Coordinate m_coord[MaxCoords];
|
||||
};
|
||||
|
||||
class CoordEq
|
||||
{
|
||||
public:
|
||||
CoordEq();
|
||||
VOID remove(Coordinate& co);
|
||||
BOOL_32 Exists(Coordinate& co);
|
||||
VOID resize(UINT_32 n);
|
||||
UINT_32 getsize();
|
||||
virtual UINT_64 solve(UINT_32 x, UINT_32 y, UINT_32 z = 0, UINT_32 s = 0, UINT_32 m = 0) const;
|
||||
virtual VOID solveAddr(UINT_64 addr, UINT_32 sliceInM,
|
||||
UINT_32& x, UINT_32& y, UINT_32& z, UINT_32& s, UINT_32& m) const;
|
||||
|
||||
VOID copy(CoordEq& o, UINT_32 start = 0, UINT_32 num = 0xFFFFFFFF);
|
||||
VOID reverse(UINT_32 start = 0, UINT_32 num = 0xFFFFFFFF);
|
||||
VOID xorin(CoordEq& x, UINT_32 start = 0);
|
||||
UINT_32 Filter(INT_8 f, Coordinate& co, UINT_32 start = 0, INT_8 axis = '\0');
|
||||
VOID shift(INT_32 amount, INT_32 start = 0);
|
||||
virtual CoordTerm& operator[](UINT_32 i);
|
||||
VOID mort2d(Coordinate& c0, Coordinate& c1, UINT_32 start = 0, UINT_32 end = 0);
|
||||
VOID mort3d(Coordinate& c0, Coordinate& c1, Coordinate& c2, UINT_32 start = 0, UINT_32 end = 0);
|
||||
|
||||
BOOL_32 operator==(const CoordEq& b);
|
||||
BOOL_32 operator!=(const CoordEq& b);
|
||||
|
||||
private:
|
||||
static const UINT_32 MaxEqBits = 64;
|
||||
UINT_32 m_numBits;
|
||||
|
||||
CoordTerm m_eq[MaxEqBits];
|
||||
};
|
||||
|
||||
} // V2
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
+6119
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
+4327
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
+583
@@ -0,0 +1,583 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @file gfx10addrlib.h
|
||||
* @brief Contains the Gfx10Lib class definition.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __GFX10_ADDR_LIB_H__
|
||||
#define __GFX10_ADDR_LIB_H__
|
||||
|
||||
#include "addrlib2.h"
|
||||
#include "coord.h"
|
||||
#include "gfx10SwizzlePattern.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V2
|
||||
{
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief GFX10 specific settings structure.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
struct Gfx10ChipSettings
|
||||
{
|
||||
struct
|
||||
{
|
||||
UINT_32 reserved1 : 32;
|
||||
|
||||
// Misc configuration bits
|
||||
UINT_32 isDcn2 : 1;
|
||||
UINT_32 supportRbPlus : 1;
|
||||
UINT_32 dsMipmapHtileFix : 1;
|
||||
UINT_32 dccUnsup3DSwDis : 1;
|
||||
UINT_32 reserved2 : 28;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief GFX10 data surface type.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
enum Gfx10DataType
|
||||
{
|
||||
Gfx10DataColor,
|
||||
Gfx10DataDepthStencil,
|
||||
Gfx10DataFmask
|
||||
};
|
||||
|
||||
const UINT_32 Gfx10LinearSwModeMask = (1u << ADDR_SW_LINEAR);
|
||||
|
||||
const UINT_32 Gfx10Blk256BSwModeMask = (1u << ADDR_SW_256B_S) |
|
||||
(1u << ADDR_SW_256B_D);
|
||||
|
||||
const UINT_32 Gfx10Blk4KBSwModeMask = (1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_4KB_D_X);
|
||||
|
||||
const UINT_32 Gfx10Blk64KBSwModeMask = (1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Gfx10BlkVarSwModeMask = (1u << ADDR_SW_VAR_Z_X) |
|
||||
(1u << ADDR_SW_VAR_R_X);
|
||||
|
||||
const UINT_32 Gfx10ZSwModeMask = (1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_VAR_Z_X);
|
||||
|
||||
const UINT_32 Gfx10StandardSwModeMask = (1u << ADDR_SW_256B_S) |
|
||||
(1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_S_X);
|
||||
|
||||
const UINT_32 Gfx10DisplaySwModeMask = (1u << ADDR_SW_256B_D) |
|
||||
(1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_D_X);
|
||||
|
||||
const UINT_32 Gfx10RenderSwModeMask = (1u << ADDR_SW_64KB_R_X) |
|
||||
(1u << ADDR_SW_VAR_R_X);
|
||||
|
||||
const UINT_32 Gfx10XSwModeMask = (1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_R_X) |
|
||||
Gfx10BlkVarSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10TSwModeMask = (1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_64KB_D_T);
|
||||
|
||||
const UINT_32 Gfx10XorSwModeMask = Gfx10XSwModeMask |
|
||||
Gfx10TSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc1dSwModeMask = Gfx10LinearSwModeMask |
|
||||
Gfx10RenderSwModeMask |
|
||||
Gfx10ZSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc2dSwModeMask = Gfx10LinearSwModeMask |
|
||||
Gfx10Blk256BSwModeMask |
|
||||
Gfx10Blk4KBSwModeMask |
|
||||
Gfx10Blk64KBSwModeMask |
|
||||
Gfx10BlkVarSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dSwModeMask = (1u << ADDR_SW_LINEAR) |
|
||||
(1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_R_X) |
|
||||
Gfx10BlkVarSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc2dPrtSwModeMask = (Gfx10Blk4KBSwModeMask | Gfx10Blk64KBSwModeMask) & ~Gfx10XSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dPrtSwModeMask = Gfx10Rsrc2dPrtSwModeMask & ~Gfx10DisplaySwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dThin64KBSwModeMask = (1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dThinSwModeMask = Gfx10Rsrc3dThin64KBSwModeMask | Gfx10BlkVarSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dThickSwModeMask = Gfx10Rsrc3dSwModeMask & ~(Gfx10Rsrc3dThinSwModeMask | Gfx10LinearSwModeMask);
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dThick4KBSwModeMask = Gfx10Rsrc3dThickSwModeMask & Gfx10Blk4KBSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10Rsrc3dThick64KBSwModeMask = Gfx10Rsrc3dThickSwModeMask & Gfx10Blk64KBSwModeMask;
|
||||
|
||||
const UINT_32 Gfx10MsaaSwModeMask = Gfx10ZSwModeMask |
|
||||
Gfx10RenderSwModeMask;
|
||||
|
||||
const UINT_32 Dcn2NonBpp64SwModeMask = (1u << ADDR_SW_LINEAR) |
|
||||
(1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Dcn2Bpp64SwModeMask = (1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
Dcn2NonBpp64SwModeMask;
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief This class is the GFX10 specific address library
|
||||
* function set.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
class Gfx10Lib : public Lib
|
||||
{
|
||||
public:
|
||||
/// Creates Gfx10Lib object
|
||||
static Addr::Lib* CreateObj(const Client* pClient)
|
||||
{
|
||||
VOID* pMem = Object::ClientAlloc(sizeof(Gfx10Lib), pClient);
|
||||
return (pMem != NULL) ? new (pMem) Gfx10Lib(pClient) : NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
Gfx10Lib(const Client* pClient);
|
||||
virtual ~Gfx10Lib();
|
||||
|
||||
virtual BOOL_32 HwlIsStandardSwizzle(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isStd;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsDisplaySwizzle(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isDisp;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsThin(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return ((IsTex1d(resourceType) == TRUE) ||
|
||||
(IsTex2d(resourceType) == TRUE) ||
|
||||
((IsTex3d(resourceType) == TRUE) &&
|
||||
(m_swizzleModeTable[swizzleMode].isStd == FALSE) &&
|
||||
(m_swizzleModeTable[swizzleMode].isDisp == FALSE)));
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsThick(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return ((IsTex3d(resourceType) == TRUE) &&
|
||||
(m_swizzleModeTable[swizzleMode].isStd || m_swizzleModeTable[swizzleMode].isDisp));
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileInfo(
|
||||
const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskInfo(
|
||||
const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
|
||||
const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
|
||||
const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
|
||||
const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
|
||||
const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord(
|
||||
const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
virtual UINT_32 HwlGetEquationIndex(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
|
||||
{
|
||||
*ppEquationTable = m_equationTable;
|
||||
|
||||
return m_numEquations;
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputePipeBankXor(
|
||||
const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
|
||||
const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
|
||||
const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
|
||||
const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
|
||||
ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxBaseAlignments() const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
|
||||
|
||||
virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn);
|
||||
|
||||
virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
|
||||
|
||||
// Initialize equation table
|
||||
VOID InitEquationTable();
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfoMacroTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceInfoMicroTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoordMacroTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceAddrFromCoordMicroTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
private:
|
||||
UINT_32 ComputeOffsetFromSwizzlePattern(
|
||||
const UINT_64* pPattern,
|
||||
UINT_32 numBits,
|
||||
UINT_32 x,
|
||||
UINT_32 y,
|
||||
UINT_32 z,
|
||||
UINT_32 s) const;
|
||||
|
||||
UINT_32 ComputeOffsetFromEquation(
|
||||
const ADDR_EQUATION* pEq,
|
||||
UINT_32 x,
|
||||
UINT_32 y,
|
||||
UINT_32 z) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeStereoInfo(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
UINT_32 blkHeight,
|
||||
UINT_32* pAlignY,
|
||||
UINT_32* pRightXor) const;
|
||||
|
||||
Dim3d GetDccCompressBlk(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 bpp) const
|
||||
{
|
||||
UINT_32 index = Log2(bpp >> 3);
|
||||
Dim3d compressBlkDim;
|
||||
|
||||
if (IsThin(resourceType, swizzleMode))
|
||||
{
|
||||
compressBlkDim.w = Block256_2d[index].w;
|
||||
compressBlkDim.h = Block256_2d[index].h;
|
||||
compressBlkDim.d = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
compressBlkDim = Block256_3d[index];
|
||||
}
|
||||
|
||||
return compressBlkDim;
|
||||
}
|
||||
|
||||
static void GetMipSize(
|
||||
UINT_32 mip0Width,
|
||||
UINT_32 mip0Height,
|
||||
UINT_32 mip0Depth,
|
||||
UINT_32 mipId,
|
||||
UINT_32* pMipWidth,
|
||||
UINT_32* pMipHeight,
|
||||
UINT_32* pMipDepth = NULL)
|
||||
{
|
||||
*pMipWidth = ShiftCeil(Max(mip0Width, 1u), mipId);
|
||||
*pMipHeight = ShiftCeil(Max(mip0Height, 1u), mipId);
|
||||
|
||||
if (pMipDepth != NULL)
|
||||
{
|
||||
*pMipDepth = ShiftCeil(Max(mip0Depth, 1u), mipId);
|
||||
}
|
||||
}
|
||||
|
||||
const ADDR_SW_PATINFO* GetSwizzlePatternInfo(
|
||||
AddrSwizzleMode swizzleMode,
|
||||
AddrResourceType resourceType,
|
||||
UINT_32 log2Elem,
|
||||
UINT_32 numFrag) const;
|
||||
|
||||
VOID GetSwizzlePatternFromPatternInfo(
|
||||
const ADDR_SW_PATINFO* pPatInfo,
|
||||
ADDR_BIT_SETTING (&pSwizzle)[20]) const
|
||||
{
|
||||
memcpy(pSwizzle,
|
||||
GFX10_SW_PATTERN_NIBBLE01[pPatInfo->nibble01Idx],
|
||||
sizeof(GFX10_SW_PATTERN_NIBBLE01[pPatInfo->nibble01Idx]));
|
||||
|
||||
memcpy(&pSwizzle[8],
|
||||
GFX10_SW_PATTERN_NIBBLE2[pPatInfo->nibble2Idx],
|
||||
sizeof(GFX10_SW_PATTERN_NIBBLE2[pPatInfo->nibble2Idx]));
|
||||
|
||||
memcpy(&pSwizzle[12],
|
||||
GFX10_SW_PATTERN_NIBBLE3[pPatInfo->nibble3Idx],
|
||||
sizeof(GFX10_SW_PATTERN_NIBBLE3[pPatInfo->nibble3Idx]));
|
||||
|
||||
memcpy(&pSwizzle[16],
|
||||
GFX10_SW_PATTERN_NIBBLE4[pPatInfo->nibble4Idx],
|
||||
sizeof(GFX10_SW_PATTERN_NIBBLE4[pPatInfo->nibble4Idx]));
|
||||
}
|
||||
|
||||
VOID ConvertSwizzlePatternToEquation(
|
||||
UINT_32 elemLog2,
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
const ADDR_SW_PATINFO* pPatInfo,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
static INT_32 GetMetaElementSizeLog2(Gfx10DataType dataType);
|
||||
|
||||
static INT_32 GetMetaCacheSizeLog2(Gfx10DataType dataType);
|
||||
|
||||
void GetBlk256SizeLog2(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 elemLog2,
|
||||
UINT_32 numSamplesLog2,
|
||||
Dim3d* pBlock) const;
|
||||
|
||||
void GetCompressedBlockSizeLog2(
|
||||
Gfx10DataType dataType,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 elemLog2,
|
||||
UINT_32 numSamplesLog2,
|
||||
Dim3d* pBlock) const;
|
||||
|
||||
INT_32 GetMetaOverlapLog2(
|
||||
Gfx10DataType dataType,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 elemLog2,
|
||||
UINT_32 numSamplesLog2) const;
|
||||
|
||||
INT_32 Get3DMetaOverlapLog2(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 elemLog2) const;
|
||||
|
||||
UINT_32 GetMetaBlkSize(
|
||||
Gfx10DataType dataType,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 elemLog2,
|
||||
UINT_32 numSamplesLog2,
|
||||
BOOL_32 pipeAlign,
|
||||
Dim3d* pBlock) const;
|
||||
|
||||
INT_32 GetPipeRotateAmount(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const;
|
||||
|
||||
INT_32 GetEffectiveNumPipes() const
|
||||
{
|
||||
return ((m_settings.supportRbPlus == FALSE) ||
|
||||
((m_numSaLog2 + 1) >= m_pipesLog2)) ? m_pipesLog2 : m_numSaLog2 + 1;
|
||||
}
|
||||
|
||||
BOOL_32 IsRbAligned(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
const BOOL_32 isRtopt = IsRtOptSwizzle(swizzleMode);
|
||||
const BOOL_32 isZ = IsZOrderSwizzle(swizzleMode);
|
||||
const BOOL_32 isDisplay = IsDisplaySwizzle(swizzleMode);
|
||||
|
||||
return (IsTex2d(resourceType) && (isRtopt || isZ)) ||
|
||||
(IsTex3d(resourceType) && isDisplay);
|
||||
|
||||
}
|
||||
|
||||
BOOL_32 IsValidDisplaySwizzleMode(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
UINT_32 GetMaxNumMipsInTail(UINT_32 blockSizeLog2, BOOL_32 isThin) const;
|
||||
|
||||
static ADDR2_BLOCK_SET GetAllowedBlockSet(ADDR2_SWMODE_SET allowedSwModeSet, AddrResourceType rsrcType)
|
||||
{
|
||||
ADDR2_BLOCK_SET allowedBlockSet = {};
|
||||
|
||||
allowedBlockSet.micro = (allowedSwModeSet.value & Gfx10Blk256BSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.linear = (allowedSwModeSet.value & Gfx10LinearSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.var = (allowedSwModeSet.value & Gfx10BlkVarSwModeMask) ? TRUE : FALSE;
|
||||
|
||||
if (rsrcType == ADDR_RSRC_TEX_3D)
|
||||
{
|
||||
allowedBlockSet.macroThick4KB = (allowedSwModeSet.value & Gfx10Rsrc3dThick4KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThin64KB = (allowedSwModeSet.value & Gfx10Rsrc3dThin64KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThick64KB = (allowedSwModeSet.value & Gfx10Rsrc3dThick64KBSwModeMask) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
allowedBlockSet.macroThin4KB = (allowedSwModeSet.value & Gfx10Blk4KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThin64KB = (allowedSwModeSet.value & Gfx10Blk64KBSwModeMask) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
return allowedBlockSet;
|
||||
}
|
||||
|
||||
static ADDR2_SWTYPE_SET GetAllowedSwSet(ADDR2_SWMODE_SET allowedSwModeSet)
|
||||
{
|
||||
ADDR2_SWTYPE_SET allowedSwSet = {};
|
||||
|
||||
allowedSwSet.sw_Z = (allowedSwModeSet.value & Gfx10ZSwModeMask) ? TRUE : FALSE;
|
||||
allowedSwSet.sw_S = (allowedSwModeSet.value & Gfx10StandardSwModeMask) ? TRUE : FALSE;
|
||||
allowedSwSet.sw_D = (allowedSwModeSet.value & Gfx10DisplaySwModeMask) ? TRUE : FALSE;
|
||||
allowedSwSet.sw_R = (allowedSwModeSet.value & Gfx10RenderSwModeMask) ? TRUE : FALSE;
|
||||
|
||||
return allowedSwSet;
|
||||
}
|
||||
|
||||
BOOL_32 IsInMipTail(
|
||||
Dim3d mipTailDim,
|
||||
UINT_32 maxNumMipsInTail,
|
||||
UINT_32 mipWidth,
|
||||
UINT_32 mipHeight,
|
||||
UINT_32 numMipsToTheEnd) const
|
||||
{
|
||||
BOOL_32 inTail = ((mipWidth <= mipTailDim.w) &&
|
||||
(mipHeight <= mipTailDim.h) &&
|
||||
(numMipsToTheEnd <= maxNumMipsInTail));
|
||||
|
||||
return inTail;
|
||||
}
|
||||
|
||||
UINT_32 GetBankXorBits(UINT_32 blockBits) const
|
||||
{
|
||||
return (blockBits > m_pipeInterleaveLog2 + m_pipesLog2 + ColumnBits) ?
|
||||
Min(blockBits - m_pipeInterleaveLog2 - m_pipesLog2 - ColumnBits, BankBits) : 0;
|
||||
}
|
||||
|
||||
BOOL_32 ValidateNonSwModeParams(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
BOOL_32 ValidateSwModeParams(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
static const UINT_32 ColumnBits = 2;
|
||||
static const UINT_32 BankBits = 4;
|
||||
static const UINT_32 UnalignedDccType = 3;
|
||||
|
||||
static const Dim3d Block256_3d[MaxNumOfBpp];
|
||||
static const Dim3d Block64K_Log2_3d[MaxNumOfBpp];
|
||||
static const Dim3d Block4K_Log2_3d[MaxNumOfBpp];
|
||||
|
||||
static const SwizzleModeFlags SwizzleModeTable[ADDR_SW_MAX_TYPE];
|
||||
|
||||
// Number of packers log2
|
||||
UINT_32 m_numPkrLog2;
|
||||
// Number of shader array log2
|
||||
UINT_32 m_numSaLog2;
|
||||
|
||||
Gfx10ChipSettings m_settings;
|
||||
|
||||
UINT_32 m_colorBaseIndex;
|
||||
UINT_32 m_xmaskBaseIndex;
|
||||
UINT_32 m_dccBaseIndex;
|
||||
};
|
||||
|
||||
} // V2
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
+5076
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,640 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @file gfx9addrlib.h
|
||||
* @brief Contgfx9ns the Gfx9Lib class definition.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __GFX9_ADDR_LIB_H__
|
||||
#define __GFX9_ADDR_LIB_H__
|
||||
|
||||
#include "addrlib2.h"
|
||||
#include "coord.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V2
|
||||
{
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief GFX9 specific settings structure.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
struct Gfx9ChipSettings
|
||||
{
|
||||
struct
|
||||
{
|
||||
// Asic/Generation name
|
||||
UINT_32 isArcticIsland : 1;
|
||||
UINT_32 isVega10 : 1;
|
||||
UINT_32 isRaven : 1;
|
||||
UINT_32 isVega12 : 1;
|
||||
UINT_32 isVega20 : 1;
|
||||
UINT_32 reserved0 : 27;
|
||||
|
||||
// Display engine IP version name
|
||||
UINT_32 isDce12 : 1;
|
||||
UINT_32 isDcn1 : 1;
|
||||
UINT_32 reserved1 : 30;
|
||||
|
||||
// Misc configuration bits
|
||||
UINT_32 metaBaseAlignFix : 1;
|
||||
UINT_32 depthPipeXorDisable : 1;
|
||||
UINT_32 htileAlignFix : 1;
|
||||
UINT_32 applyAliasFix : 1;
|
||||
UINT_32 htileCacheRbConflict: 1;
|
||||
UINT_32 reserved2 : 27;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief GFX9 data surface type.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
enum Gfx9DataType
|
||||
{
|
||||
Gfx9DataColor,
|
||||
Gfx9DataDepthStencil,
|
||||
Gfx9DataFmask
|
||||
};
|
||||
|
||||
const UINT_32 Gfx9LinearSwModeMask = (1u << ADDR_SW_LINEAR);
|
||||
|
||||
const UINT_32 Gfx9Blk256BSwModeMask = (1u << ADDR_SW_256B_S) |
|
||||
(1u << ADDR_SW_256B_D) |
|
||||
(1u << ADDR_SW_256B_R);
|
||||
|
||||
const UINT_32 Gfx9Blk4KBSwModeMask = (1u << ADDR_SW_4KB_Z) |
|
||||
(1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_4KB_R) |
|
||||
(1u << ADDR_SW_4KB_Z_X) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_4KB_R_X);
|
||||
|
||||
const UINT_32 Gfx9Blk64KBSwModeMask = (1u << ADDR_SW_64KB_Z) |
|
||||
(1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_R) |
|
||||
(1u << ADDR_SW_64KB_Z_T) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_64KB_R_T) |
|
||||
(1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Gfx9ZSwModeMask = (1u << ADDR_SW_4KB_Z) |
|
||||
(1u << ADDR_SW_64KB_Z) |
|
||||
(1u << ADDR_SW_64KB_Z_T) |
|
||||
(1u << ADDR_SW_4KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_Z_X);
|
||||
|
||||
const UINT_32 Gfx9StandardSwModeMask = (1u << ADDR_SW_256B_S) |
|
||||
(1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_S_X);
|
||||
|
||||
const UINT_32 Gfx9DisplaySwModeMask = (1u << ADDR_SW_256B_D) |
|
||||
(1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_D_X);
|
||||
|
||||
const UINT_32 Gfx9RotateSwModeMask = (1u << ADDR_SW_256B_R) |
|
||||
(1u << ADDR_SW_4KB_R) |
|
||||
(1u << ADDR_SW_64KB_R) |
|
||||
(1u << ADDR_SW_64KB_R_T) |
|
||||
(1u << ADDR_SW_4KB_R_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Gfx9XSwModeMask = (1u << ADDR_SW_4KB_Z_X) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_4KB_R_X) |
|
||||
(1u << ADDR_SW_64KB_Z_X) |
|
||||
(1u << ADDR_SW_64KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Gfx9TSwModeMask = (1u << ADDR_SW_64KB_Z_T) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_64KB_R_T);
|
||||
|
||||
const UINT_32 Gfx9XorSwModeMask = Gfx9XSwModeMask |
|
||||
Gfx9TSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9AllSwModeMask = Gfx9LinearSwModeMask |
|
||||
Gfx9ZSwModeMask |
|
||||
Gfx9StandardSwModeMask |
|
||||
Gfx9DisplaySwModeMask |
|
||||
Gfx9RotateSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc1dSwModeMask = Gfx9LinearSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc2dSwModeMask = Gfx9AllSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dSwModeMask = Gfx9AllSwModeMask & ~Gfx9Blk256BSwModeMask & ~Gfx9RotateSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc2dPrtSwModeMask = (Gfx9Blk4KBSwModeMask | Gfx9Blk64KBSwModeMask) & ~Gfx9XSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dPrtSwModeMask = Gfx9Rsrc2dPrtSwModeMask & ~Gfx9RotateSwModeMask & ~Gfx9DisplaySwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dThinSwModeMask = Gfx9DisplaySwModeMask & ~Gfx9Blk256BSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dThin4KBSwModeMask = Gfx9Rsrc3dThinSwModeMask & Gfx9Blk4KBSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dThin64KBSwModeMask = Gfx9Rsrc3dThinSwModeMask & Gfx9Blk64KBSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dThickSwModeMask = Gfx9Rsrc3dSwModeMask & ~(Gfx9Rsrc3dThinSwModeMask | Gfx9LinearSwModeMask);
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dThick4KBSwModeMask = Gfx9Rsrc3dThickSwModeMask & Gfx9Blk4KBSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9Rsrc3dThick64KBSwModeMask = Gfx9Rsrc3dThickSwModeMask & Gfx9Blk64KBSwModeMask;
|
||||
|
||||
const UINT_32 Gfx9MsaaSwModeMask = Gfx9AllSwModeMask & ~Gfx9Blk256BSwModeMask & ~Gfx9LinearSwModeMask;
|
||||
|
||||
const UINT_32 Dce12NonBpp32SwModeMask = (1u << ADDR_SW_LINEAR) |
|
||||
(1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_4KB_R) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_R) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_4KB_R_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_R_X);
|
||||
|
||||
const UINT_32 Dce12Bpp32SwModeMask = (1u << ADDR_SW_256B_D) |
|
||||
(1u << ADDR_SW_256B_R) |
|
||||
Dce12NonBpp32SwModeMask;
|
||||
|
||||
const UINT_32 Dcn1NonBpp64SwModeMask = (1u << ADDR_SW_LINEAR) |
|
||||
(1u << ADDR_SW_4KB_S) |
|
||||
(1u << ADDR_SW_64KB_S) |
|
||||
(1u << ADDR_SW_64KB_S_T) |
|
||||
(1u << ADDR_SW_4KB_S_X) |
|
||||
(1u << ADDR_SW_64KB_S_X);
|
||||
const UINT_32 Dcn1Bpp64SwModeMask = (1u << ADDR_SW_4KB_D) |
|
||||
(1u << ADDR_SW_64KB_D) |
|
||||
(1u << ADDR_SW_64KB_D_T) |
|
||||
(1u << ADDR_SW_4KB_D_X) |
|
||||
(1u << ADDR_SW_64KB_D_X) |
|
||||
Dcn1NonBpp64SwModeMask;
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief GFX9 meta equation parameters
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
struct MetaEqParams
|
||||
{
|
||||
UINT_32 maxMip;
|
||||
UINT_32 elementBytesLog2;
|
||||
UINT_32 numSamplesLog2;
|
||||
ADDR2_META_FLAGS metaFlag;
|
||||
Gfx9DataType dataSurfaceType;
|
||||
AddrSwizzleMode swizzleMode;
|
||||
AddrResourceType resourceType;
|
||||
UINT_32 metaBlkWidthLog2;
|
||||
UINT_32 metaBlkHeightLog2;
|
||||
UINT_32 metaBlkDepthLog2;
|
||||
UINT_32 compBlkWidthLog2;
|
||||
UINT_32 compBlkHeightLog2;
|
||||
UINT_32 compBlkDepthLog2;
|
||||
};
|
||||
|
||||
/**
|
||||
************************************************************************************************************************
|
||||
* @brief This class is the GFX9 specific address library
|
||||
* function set.
|
||||
************************************************************************************************************************
|
||||
*/
|
||||
class Gfx9Lib : public Lib
|
||||
{
|
||||
public:
|
||||
/// Creates Gfx9Lib object
|
||||
static Addr::Lib* CreateObj(const Client* pClient)
|
||||
{
|
||||
VOID* pMem = Object::ClientAlloc(sizeof(Gfx9Lib), pClient);
|
||||
return (pMem != NULL) ? new (pMem) Gfx9Lib(pClient) : NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
Gfx9Lib(const Client* pClient);
|
||||
virtual ~Gfx9Lib();
|
||||
|
||||
virtual BOOL_32 HwlIsStandardSwizzle(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return m_swizzleModeTable[swizzleMode].isStd ||
|
||||
(IsTex3d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp);
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsDisplaySwizzle(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return IsTex2d(resourceType) && m_swizzleModeTable[swizzleMode].isDisp;
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsThin(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return ((IsTex2d(resourceType) == TRUE) ||
|
||||
((IsTex3d(resourceType) == TRUE) &&
|
||||
(m_swizzleModeTable[swizzleMode].isZ == FALSE) &&
|
||||
(m_swizzleModeTable[swizzleMode].isStd == FALSE)));
|
||||
}
|
||||
|
||||
virtual BOOL_32 HwlIsThick(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
return (IsTex3d(resourceType) &&
|
||||
(m_swizzleModeTable[swizzleMode].isZ || m_swizzleModeTable[swizzleMode].isStd));
|
||||
}
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileInfo(
|
||||
const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskInfo(
|
||||
const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
|
||||
const ADDR2_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
|
||||
const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
|
||||
const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileCoordFromAddr(
|
||||
const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccAddrFromCoord(
|
||||
const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut);
|
||||
|
||||
virtual UINT_32 HwlGetEquationIndex(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeBlock256Equation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeThinEquation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeThickEquation(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2,
|
||||
ADDR_EQUATION* pEquation) const;
|
||||
|
||||
// Get equation table pointer and number of equations
|
||||
virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
|
||||
{
|
||||
*ppEquationTable = m_equationTable;
|
||||
|
||||
return m_numEquations;
|
||||
}
|
||||
|
||||
virtual BOOL_32 IsEquationSupported(
|
||||
AddrResourceType rsrcType,
|
||||
AddrSwizzleMode swMode,
|
||||
UINT_32 elementBytesLog2) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputePipeBankXor(
|
||||
const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSlicePipeBankXor(
|
||||
const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSubResourceOffsetForSwizzlePattern(
|
||||
const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlGetPreferredSurfaceSetting(
|
||||
const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn,
|
||||
ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoSanityCheck(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfoLinear(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoordTiled(
|
||||
const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxBaseAlignments() const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
|
||||
|
||||
virtual BOOL_32 HwlInitGlobalParams(const ADDR_CREATE_INPUT* pCreateIn);
|
||||
|
||||
virtual ChipFamily HwlConvertChipFamily(UINT_32 uChipFamily, UINT_32 uChipRevision);
|
||||
|
||||
virtual VOID ComputeThinBlockDimension(
|
||||
UINT_32* pWidth,
|
||||
UINT_32* pHeight,
|
||||
UINT_32* pDepth,
|
||||
UINT_32 bpp,
|
||||
UINT_32 numSamples,
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode) const;
|
||||
|
||||
private:
|
||||
VOID GetRbEquation(CoordEq* pRbEq, UINT_32 rbPerSeLog2, UINT_32 seLog2) const;
|
||||
|
||||
VOID GetDataEquation(CoordEq* pDataEq, Gfx9DataType dataSurfaceType,
|
||||
AddrSwizzleMode swizzleMode, AddrResourceType resourceType,
|
||||
UINT_32 elementBytesLog2, UINT_32 numSamplesLog2) const;
|
||||
|
||||
VOID GetPipeEquation(CoordEq* pPipeEq, CoordEq* pDataEq,
|
||||
UINT_32 pipeInterleaveLog2, UINT_32 numPipesLog2,
|
||||
UINT_32 numSamplesLog2, Gfx9DataType dataSurfaceType,
|
||||
AddrSwizzleMode swizzleMode, AddrResourceType resourceType) const;
|
||||
|
||||
VOID GenMetaEquation(CoordEq* pMetaEq, UINT_32 maxMip,
|
||||
UINT_32 elementBytesLog2, UINT_32 numSamplesLog2,
|
||||
ADDR2_META_FLAGS metaFlag, Gfx9DataType dataSurfaceType,
|
||||
AddrSwizzleMode swizzleMode, AddrResourceType resourceType,
|
||||
UINT_32 metaBlkWidthLog2, UINT_32 metaBlkHeightLog2,
|
||||
UINT_32 metaBlkDepthLog2, UINT_32 compBlkWidthLog2,
|
||||
UINT_32 compBlkHeightLog2, UINT_32 compBlkDepthLog2) const;
|
||||
|
||||
const CoordEq* GetMetaEquation(const MetaEqParams& metaEqParams);
|
||||
|
||||
VOID GetMetaMipInfo(UINT_32 numMipLevels, Dim3d* pMetaBlkDim,
|
||||
BOOL_32 dataThick, ADDR2_META_MIP_INFO* pInfo,
|
||||
UINT_32 mip0Width, UINT_32 mip0Height, UINT_32 mip0Depth,
|
||||
UINT_32* pNumMetaBlkX, UINT_32* pNumMetaBlkY, UINT_32* pNumMetaBlkZ) const;
|
||||
|
||||
BOOL_32 IsValidDisplaySwizzleMode(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeSurfaceLinearPadding(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
UINT_32* pMipmap0PaddedWidth,
|
||||
UINT_32* pSlice0PaddedHeight,
|
||||
ADDR2_MIP_INFO* pMipInfo = NULL) const;
|
||||
|
||||
static ADDR2_BLOCK_SET GetAllowedBlockSet(ADDR2_SWMODE_SET allowedSwModeSet, AddrResourceType rsrcType)
|
||||
{
|
||||
ADDR2_BLOCK_SET allowedBlockSet = {};
|
||||
|
||||
allowedBlockSet.micro = (allowedSwModeSet.value & Gfx9Blk256BSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.linear = (allowedSwModeSet.value & Gfx9LinearSwModeMask) ? TRUE : FALSE;
|
||||
|
||||
if (rsrcType == ADDR_RSRC_TEX_3D)
|
||||
{
|
||||
allowedBlockSet.macroThin4KB = (allowedSwModeSet.value & Gfx9Rsrc3dThin4KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThick4KB = (allowedSwModeSet.value & Gfx9Rsrc3dThick4KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThin64KB = (allowedSwModeSet.value & Gfx9Rsrc3dThin64KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThick64KB = (allowedSwModeSet.value & Gfx9Rsrc3dThick64KBSwModeMask) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
allowedBlockSet.macroThin4KB = (allowedSwModeSet.value & Gfx9Blk4KBSwModeMask) ? TRUE : FALSE;
|
||||
allowedBlockSet.macroThin64KB = (allowedSwModeSet.value & Gfx9Blk64KBSwModeMask) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
return allowedBlockSet;
|
||||
}
|
||||
|
||||
static ADDR2_SWTYPE_SET GetAllowedSwSet(ADDR2_SWMODE_SET allowedSwModeSet)
|
||||
{
|
||||
ADDR2_SWTYPE_SET allowedSwSet = {};
|
||||
|
||||
allowedSwSet.sw_Z = (allowedSwModeSet.value & Gfx9ZSwModeMask) ? TRUE : FALSE;
|
||||
allowedSwSet.sw_S = (allowedSwModeSet.value & Gfx9StandardSwModeMask) ? TRUE : FALSE;
|
||||
allowedSwSet.sw_D = (allowedSwModeSet.value & Gfx9DisplaySwModeMask) ? TRUE : FALSE;
|
||||
allowedSwSet.sw_R = (allowedSwModeSet.value & Gfx9RotateSwModeMask) ? TRUE : FALSE;
|
||||
|
||||
return allowedSwSet;
|
||||
}
|
||||
|
||||
BOOL_32 IsInMipTail(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
Dim3d mipTailDim,
|
||||
UINT_32 width,
|
||||
UINT_32 height,
|
||||
UINT_32 depth) const
|
||||
{
|
||||
BOOL_32 inTail = ((width <= mipTailDim.w) &&
|
||||
(height <= mipTailDim.h) &&
|
||||
(IsThin(resourceType, swizzleMode) || (depth <= mipTailDim.d)));
|
||||
|
||||
return inTail;
|
||||
}
|
||||
|
||||
BOOL_32 ValidateNonSwModeParams(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
BOOL_32 ValidateSwModeParams(const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
UINT_32 GetBankXorBits(UINT_32 macroBlockBits) const
|
||||
{
|
||||
UINT_32 pipeBits = GetPipeXorBits(macroBlockBits);
|
||||
|
||||
// Bank xor bits
|
||||
UINT_32 bankBits = Min(macroBlockBits - pipeBits - m_pipeInterleaveLog2, m_banksLog2);
|
||||
|
||||
return bankBits;
|
||||
}
|
||||
|
||||
UINT_32 ComputeSurfaceBaseAlignTiled(AddrSwizzleMode swizzleMode) const
|
||||
{
|
||||
UINT_32 baseAlign;
|
||||
|
||||
if (IsXor(swizzleMode))
|
||||
{
|
||||
baseAlign = GetBlockSize(swizzleMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
baseAlign = 256;
|
||||
}
|
||||
|
||||
return baseAlign;
|
||||
}
|
||||
|
||||
// Initialize equation table
|
||||
VOID InitEquationTable();
|
||||
|
||||
ADDR_E_RETURNCODE ComputeStereoInfo(
|
||||
const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
|
||||
UINT_32* pHeightAlign) const;
|
||||
|
||||
UINT_32 GetMipChainInfo(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 bpp,
|
||||
UINT_32 mip0Width,
|
||||
UINT_32 mip0Height,
|
||||
UINT_32 mip0Depth,
|
||||
UINT_32 blockWidth,
|
||||
UINT_32 blockHeight,
|
||||
UINT_32 blockDepth,
|
||||
UINT_32 numMipLevel,
|
||||
ADDR2_MIP_INFO* pMipInfo) const;
|
||||
|
||||
VOID GetMetaMiptailInfo(
|
||||
ADDR2_META_MIP_INFO* pInfo,
|
||||
Dim3d mipCoord,
|
||||
UINT_32 numMipInTail,
|
||||
Dim3d* pMetaBlkDim) const;
|
||||
|
||||
Dim3d GetMipStartPos(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 width,
|
||||
UINT_32 height,
|
||||
UINT_32 depth,
|
||||
UINT_32 blockWidth,
|
||||
UINT_32 blockHeight,
|
||||
UINT_32 blockDepth,
|
||||
UINT_32 mipId,
|
||||
UINT_32 log2ElementBytes,
|
||||
UINT_32* pMipTailBytesOffset) const;
|
||||
|
||||
AddrMajorMode GetMajorMode(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 mip0WidthInBlk,
|
||||
UINT_32 mip0HeightInBlk,
|
||||
UINT_32 mip0DepthInBlk) const
|
||||
{
|
||||
BOOL_32 yMajor = (mip0WidthInBlk < mip0HeightInBlk);
|
||||
BOOL_32 xMajor = (yMajor == FALSE);
|
||||
|
||||
if (IsThick(resourceType, swizzleMode))
|
||||
{
|
||||
yMajor = yMajor && (mip0HeightInBlk >= mip0DepthInBlk);
|
||||
xMajor = xMajor && (mip0WidthInBlk >= mip0DepthInBlk);
|
||||
}
|
||||
|
||||
AddrMajorMode majorMode;
|
||||
if (xMajor)
|
||||
{
|
||||
majorMode = ADDR_MAJOR_X;
|
||||
}
|
||||
else if (yMajor)
|
||||
{
|
||||
majorMode = ADDR_MAJOR_Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
majorMode = ADDR_MAJOR_Z;
|
||||
}
|
||||
|
||||
return majorMode;
|
||||
}
|
||||
|
||||
Dim3d GetDccCompressBlk(
|
||||
AddrResourceType resourceType,
|
||||
AddrSwizzleMode swizzleMode,
|
||||
UINT_32 bpp) const
|
||||
{
|
||||
UINT_32 index = Log2(bpp >> 3);
|
||||
Dim3d compressBlkDim;
|
||||
|
||||
if (IsThin(resourceType, swizzleMode))
|
||||
{
|
||||
compressBlkDim.w = Block256_2d[index].w;
|
||||
compressBlkDim.h = Block256_2d[index].h;
|
||||
compressBlkDim.d = 1;
|
||||
}
|
||||
else if (IsStandardSwizzle(resourceType, swizzleMode))
|
||||
{
|
||||
compressBlkDim = Block256_3dS[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
compressBlkDim = Block256_3dZ[index];
|
||||
}
|
||||
|
||||
return compressBlkDim;
|
||||
}
|
||||
|
||||
static const UINT_32 MaxSeLog2 = 3;
|
||||
static const UINT_32 MaxRbPerSeLog2 = 2;
|
||||
|
||||
static const Dim3d Block256_3dS[MaxNumOfBpp];
|
||||
static const Dim3d Block256_3dZ[MaxNumOfBpp];
|
||||
|
||||
static const UINT_32 MipTailOffset256B[];
|
||||
|
||||
static const SwizzleModeFlags SwizzleModeTable[ADDR_SW_MAX_TYPE];
|
||||
|
||||
static const UINT_32 MaxCachedMetaEq = 2;
|
||||
|
||||
Gfx9ChipSettings m_settings;
|
||||
|
||||
CoordEq m_cachedMetaEq[MaxCachedMetaEq];
|
||||
MetaEqParams m_cachedMetaEqKey[MaxCachedMetaEq];
|
||||
UINT_32 m_metaEqOverrideIndex;
|
||||
};
|
||||
|
||||
} // V2
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file ciaddrlib.h
|
||||
* @brief Contains the CiLib class definition.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __CI_ADDR_LIB_H__
|
||||
#define __CI_ADDR_LIB_H__
|
||||
|
||||
#include "addrlib1.h"
|
||||
#include "siaddrlib.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V1
|
||||
{
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class is the CI specific address library
|
||||
* function set.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class CiLib : public SiLib
|
||||
{
|
||||
public:
|
||||
/// Creates CiLib object
|
||||
static Addr::Lib* CreateObj(const Client* pClient)
|
||||
{
|
||||
VOID* pMem = Object::ClientAlloc(sizeof(CiLib), pClient);
|
||||
return (pMem != NULL) ? new (pMem) CiLib(pClient) : NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
CiLib(const Client* pClient);
|
||||
virtual ~CiLib();
|
||||
|
||||
protected:
|
||||
|
||||
// Hwl interface - defined in AddrLib1
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
|
||||
|
||||
virtual ChipFamily HwlConvertChipFamily(
|
||||
UINT_32 uChipFamily, UINT_32 uChipRevision);
|
||||
|
||||
virtual BOOL_32 HwlInitGlobalParams(
|
||||
const ADDR_CREATE_INPUT* pCreateIn);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
|
||||
UINT_32 bpp, INT_32 index, INT_32 macroModeIndex, ADDR_TILEINFO* pInfo,
|
||||
AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
|
||||
|
||||
virtual VOID HwlComputeTileDataWidthAndHeightLinear(
|
||||
UINT_32* pMacroWidth, UINT_32* pMacroHeight,
|
||||
UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual INT_32 HwlComputeMacroModeIndex(
|
||||
INT_32 tileIndex, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
|
||||
ADDR_TILEINFO* pTileInfo, AddrTileMode* pTileMode = NULL, AddrTileType* pTileType = NULL
|
||||
) const;
|
||||
|
||||
// Sub-hwl interface - defined in EgBasedLib
|
||||
virtual VOID HwlSetupTileInfo(
|
||||
AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
|
||||
AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual INT_32 HwlPostCheckTileIndex(
|
||||
const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
|
||||
INT curIndex = TileIndexInvalid) const;
|
||||
|
||||
virtual VOID HwlFmaskPreThunkSurfInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
|
||||
const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
|
||||
|
||||
virtual VOID HwlFmaskPostThunkSurfInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
|
||||
|
||||
virtual AddrTileMode HwlDegradeThickTileMode(
|
||||
AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
|
||||
|
||||
virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
/// Overwrite tile setting to PRT
|
||||
virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
|
||||
const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
|
||||
const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxBaseAlignments() const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
|
||||
|
||||
virtual VOID HwlPadDimensions(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
|
||||
UINT_32* pPitch, UINT_32 *PitchAlign, UINT_32 height, UINT_32 heightAlign) const;
|
||||
|
||||
virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
private:
|
||||
VOID ReadGbTileMode(
|
||||
UINT_32 regValue, TileConfig* pCfg) const;
|
||||
|
||||
VOID ReadGbMacroTileCfg(
|
||||
UINT_32 regValue, ADDR_TILEINFO* pCfg) const;
|
||||
|
||||
private:
|
||||
BOOL_32 InitTileSettingTable(
|
||||
const UINT_32 *pSetting, UINT_32 noOfEntries);
|
||||
|
||||
BOOL_32 InitMacroTileCfgTable(
|
||||
const UINT_32 *pSetting, UINT_32 noOfEntries);
|
||||
|
||||
UINT_64 HwlComputeMetadataNibbleAddress(
|
||||
UINT_64 uncompressedDataByteAddress,
|
||||
UINT_64 dataBaseByteAddress,
|
||||
UINT_64 metadataBaseByteAddress,
|
||||
UINT_32 metadataBitSize,
|
||||
UINT_32 elementBitSize,
|
||||
UINT_32 blockByteSize,
|
||||
UINT_32 pipeInterleaveBytes,
|
||||
UINT_32 numOfPipes,
|
||||
UINT_32 numOfBanks,
|
||||
UINT_32 numOfSamplesPerSplit) const;
|
||||
|
||||
BOOL_32 DepthStencilTileCfgMatch(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
BOOL_32 CheckTcCompatibility(const ADDR_TILEINFO* pTileInfo, UINT_32 bpp, AddrTileMode tileMode,
|
||||
AddrTileType tileType, const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
BOOL_32 SupportDccAndTcCompatibility() const
|
||||
{
|
||||
return ((m_settings.isVolcanicIslands == TRUE) || (m_configFlags.forceDccAndTcCompat == TRUE));
|
||||
}
|
||||
|
||||
static const UINT_32 MacroTileTableSize = 16;
|
||||
static const UINT_32 PrtMacroModeOffset = MacroTileTableSize / 2;
|
||||
static const INT_32 MinDepth2DThinIndex = 0;
|
||||
static const INT_32 MaxDepth2DThinIndex = 4;
|
||||
static const INT_32 Depth1DThinIndex = 5;
|
||||
|
||||
ADDR_TILEINFO m_macroTileTable[MacroTileTableSize];
|
||||
UINT_32 m_noOfMacroEntries;
|
||||
BOOL_32 m_allowNonDispThickModes;
|
||||
};
|
||||
|
||||
} // V1
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
+4153
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,430 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file egbaddrlib.h
|
||||
* @brief Contains the EgBasedLib class definition.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __EG_BASED_ADDR_LIB_H__
|
||||
#define __EG_BASED_ADDR_LIB_H__
|
||||
|
||||
#include "addrlib1.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V1
|
||||
{
|
||||
/// Structures for functions
|
||||
struct CoordFromBankPipe
|
||||
{
|
||||
UINT_32 xBits : 3;
|
||||
UINT_32 yBits : 4;
|
||||
|
||||
UINT_32 xBit3 : 1;
|
||||
UINT_32 xBit4 : 1;
|
||||
UINT_32 xBit5 : 1;
|
||||
UINT_32 yBit3 : 1;
|
||||
UINT_32 yBit4 : 1;
|
||||
UINT_32 yBit5 : 1;
|
||||
UINT_32 yBit6 : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class is the Evergreen based address library
|
||||
* @note Abstract class
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class EgBasedLib : public Lib
|
||||
{
|
||||
protected:
|
||||
EgBasedLib(const Client* pClient);
|
||||
virtual ~EgBasedLib();
|
||||
|
||||
public:
|
||||
|
||||
/// Surface info functions
|
||||
|
||||
// NOTE: DispatchComputeSurfaceInfo using TileInfo takes both an input and an output.
|
||||
// On input:
|
||||
// One or more fields may be 0 to be calculated/defaulted - pre-SI h/w.
|
||||
// H/W using tile mode index only accepts none or all 0's - SI and newer h/w.
|
||||
// It then returns the actual tiling configuration used.
|
||||
// Other methods' TileInfo must be valid on entry
|
||||
BOOL_32 DispatchComputeSurfaceInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
ADDR_E_RETURNCODE DispatchComputeFmaskInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
|
||||
|
||||
protected:
|
||||
// Hwl interface
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceAddrFromCoord(
|
||||
const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceCoordFromAddr(
|
||||
const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSliceTileSwizzle(
|
||||
const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
|
||||
ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlExtractBankPipeSwizzle(
|
||||
const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlCombineBankPipeSwizzle(
|
||||
UINT_32 bankSwizzle, UINT_32 pipeSwizzle, ADDR_TILEINFO* pTileInfo,
|
||||
UINT_64 baseAddr, UINT_32* pTileSwizzle) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeBaseSwizzle(
|
||||
const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
|
||||
ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
|
||||
const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
|
||||
ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_32 HwlComputeHtileBpp(
|
||||
BOOL_32 isWidth8, BOOL_32 isHeight8) const;
|
||||
|
||||
virtual UINT_32 HwlComputeHtileBaseAlign(
|
||||
BOOL_32 isTcCompatible, BOOL_32 isLinear, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlComputeFmaskCoordFromAddr(
|
||||
const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const;
|
||||
|
||||
virtual UINT_32 HwlComputeQbStereoRightSwizzle(
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pInfo) const;
|
||||
|
||||
virtual VOID HwlComputePixelCoordFromOffset(
|
||||
UINT_32 offset, UINT_32 bpp, UINT_32 numSamples,
|
||||
AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample,
|
||||
AddrTileType microTileType, BOOL_32 isDepthSampleOrder) const;
|
||||
|
||||
/// Return Cmask block max
|
||||
virtual BOOL_32 HwlGetMaxCmaskBlockMax() const
|
||||
{
|
||||
return 0x3FFF; // 14 bits, 0n16383
|
||||
}
|
||||
|
||||
// Sub-hwl interface
|
||||
/// Pure virtual function to setup tile info (indices) if client requests to do so
|
||||
virtual VOID HwlSetupTileInfo(
|
||||
AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
|
||||
AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Pure virtual function to get pitch alignment for linear modes
|
||||
virtual UINT_32 HwlGetPitchAlignmentLinear(UINT_32 bpp, ADDR_SURFACE_FLAGS flags) const = 0;
|
||||
|
||||
/// Pure virtual function to get size adjustment for linear modes
|
||||
virtual UINT_64 HwlGetSizeAdjustmentLinear(
|
||||
AddrTileMode tileMode,
|
||||
UINT_32 bpp, UINT_32 numSamples, UINT_32 baseAlign, UINT_32 pitchAlign,
|
||||
UINT_32 *pPitch, UINT_32 *pHeight, UINT_32 *pHeightAlign) const = 0;
|
||||
|
||||
virtual UINT_32 HwlGetPitchAlignmentMicroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples) const;
|
||||
|
||||
virtual UINT_64 HwlGetSizeAdjustmentMicroTiled(
|
||||
UINT_32 thickness, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
|
||||
UINT_32 baseAlign, UINT_32 pitchAlign,
|
||||
UINT_32 *pPitch, UINT_32 *pHeight) const;
|
||||
|
||||
/// Pure virtual function to do extra sanity check
|
||||
virtual BOOL_32 HwlSanityCheckMacroTiled(
|
||||
ADDR_TILEINFO* pTileInfo) const = 0;
|
||||
|
||||
/// Pure virtual function to check current level to be the last macro tiled one
|
||||
virtual VOID HwlCheckLastMacroTiledLvl(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
|
||||
|
||||
/// Adjusts bank before bank is modified by rotation
|
||||
virtual UINT_32 HwlPreAdjustBank(
|
||||
UINT_32 tileX, UINT_32 bank, ADDR_TILEINFO* pTileInfo) const = 0;
|
||||
|
||||
virtual VOID HwlComputeSurfaceCoord2DFromBankPipe(
|
||||
AddrTileMode tileMode, UINT_32* pX, UINT_32* pY, UINT_32 slice,
|
||||
UINT_32 bank, UINT_32 pipe,
|
||||
UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
|
||||
BOOL_32 ignoreSE,
|
||||
ADDR_TILEINFO* pTileInfo) const = 0;
|
||||
|
||||
virtual BOOL_32 HwlTileInfoEqual(
|
||||
const ADDR_TILEINFO* pLeft, const ADDR_TILEINFO* pRight) const;
|
||||
|
||||
virtual AddrTileMode HwlDegradeThickTileMode(
|
||||
AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
|
||||
|
||||
virtual INT_32 HwlPostCheckTileIndex(
|
||||
const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
|
||||
INT curIndex = TileIndexInvalid) const
|
||||
{
|
||||
return TileIndexInvalid;
|
||||
}
|
||||
|
||||
virtual VOID HwlFmaskPreThunkSurfInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
|
||||
const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const
|
||||
{
|
||||
}
|
||||
|
||||
virtual VOID HwlFmaskPostThunkSurfInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const
|
||||
{
|
||||
}
|
||||
|
||||
virtual UINT_32 HwlStereoCheckRightOffsetPadding(ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual BOOL_32 HwlReduceBankWidthHeight(
|
||||
UINT_32 tileSize, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
|
||||
UINT_32 bankHeightAlign, UINT_32 pipes,
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
// Protected non-virtual functions
|
||||
|
||||
/// Mip level functions
|
||||
AddrTileMode ComputeSurfaceMipLevelTileMode(
|
||||
AddrTileMode baseTileMode, UINT_32 bpp,
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSlices, UINT_32 numSamples,
|
||||
UINT_32 pitchAlign, UINT_32 heightAlign,
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
/// Swizzle functions
|
||||
VOID ExtractBankPipeSwizzle(
|
||||
UINT_32 base256b, ADDR_TILEINFO* pTileInfo,
|
||||
UINT_32* pBankSwizzle, UINT_32* pPipeSwizzle) const;
|
||||
|
||||
UINT_32 GetBankPipeSwizzle(
|
||||
UINT_32 bankSwizzle, UINT_32 pipeSwizzle,
|
||||
UINT_64 baseAddr, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
UINT_32 ComputeSliceTileSwizzle(
|
||||
AddrTileMode tileMode, UINT_32 baseSwizzle, UINT_32 slice, UINT_64 baseAddr,
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
/// Addressing functions
|
||||
virtual ADDR_E_RETURNCODE ComputeBankEquation(
|
||||
UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
|
||||
ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const
|
||||
{
|
||||
return ADDR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
UINT_32 ComputeBankFromCoord(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice,
|
||||
AddrTileMode tileMode, UINT_32 bankSwizzle, UINT_32 tileSpitSlice,
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
UINT_32 ComputeBankFromAddr(
|
||||
UINT_64 addr, UINT_32 numBanks, UINT_32 numPipes) const;
|
||||
|
||||
UINT_32 ComputePipeRotation(
|
||||
AddrTileMode tileMode, UINT_32 numPipes) const;
|
||||
|
||||
UINT_32 ComputeBankRotation(
|
||||
AddrTileMode tileMode, UINT_32 numBanks,
|
||||
UINT_32 numPipes) const;
|
||||
|
||||
VOID ComputeSurfaceCoord2DFromBankPipe(
|
||||
AddrTileMode tileMode, UINT_32 x, UINT_32 y, UINT_32 slice,
|
||||
UINT_32 bank, UINT_32 pipe,
|
||||
UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
|
||||
ADDR_TILEINFO* pTileInfo,
|
||||
CoordFromBankPipe *pOutput) const;
|
||||
|
||||
/// Htile/Cmask functions
|
||||
UINT_64 ComputeHtileBytes(
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 bpp,
|
||||
BOOL_32 isLinear, UINT_32 numSlices, UINT_64* sliceBytes, UINT_32 baseAlign) const;
|
||||
|
||||
ADDR_E_RETURNCODE ComputeMacroTileEquation(
|
||||
UINT_32 log2BytesPP, AddrTileMode tileMode, AddrTileType microTileType,
|
||||
ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
|
||||
|
||||
// Static functions
|
||||
static BOOL_32 IsTileInfoAllZero(const ADDR_TILEINFO* pTileInfo);
|
||||
static UINT_32 ComputeFmaskNumPlanesFromNumSamples(UINT_32 numSamples);
|
||||
static UINT_32 ComputeFmaskResolvedBppFromNumSamples(UINT_32 numSamples);
|
||||
|
||||
virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
BOOL_32 ComputeSurfaceInfoLinear(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
|
||||
UINT_32 padDims) const;
|
||||
|
||||
BOOL_32 ComputeSurfaceInfoMicroTiled(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
|
||||
UINT_32 padDims,
|
||||
AddrTileMode expTileMode) const;
|
||||
|
||||
BOOL_32 ComputeSurfaceInfoMacroTiled(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut,
|
||||
UINT_32 padDims,
|
||||
AddrTileMode expTileMode) const;
|
||||
|
||||
BOOL_32 ComputeSurfaceAlignmentsLinear(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32* pBaseAlign, UINT_32* pPitchAlign, UINT_32* pHeightAlign) const;
|
||||
|
||||
BOOL_32 ComputeSurfaceAlignmentsMicroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 mipLevel, UINT_32 numSamples,
|
||||
UINT_32* pBaseAlign, UINT_32* pPitchAlign, UINT_32* pHeightAlign) const;
|
||||
|
||||
BOOL_32 ComputeSurfaceAlignmentsMacroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 mipLevel, UINT_32 numSamples,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
/// Surface addressing functions
|
||||
UINT_64 DispatchComputeSurfaceAddrFromCoord(
|
||||
const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
VOID DispatchComputeSurfaceCoordFromAddr(
|
||||
const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
UINT_64 ComputeSurfaceAddrFromCoordMicroTiled(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
AddrTileMode tileMode,
|
||||
AddrTileType microTileType, BOOL_32 isDepthSampleOrder,
|
||||
UINT_32* pBitPosition) const;
|
||||
|
||||
UINT_64 ComputeSurfaceAddrFromCoordMacroTiled(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
AddrTileMode tileMode,
|
||||
AddrTileType microTileType, BOOL_32 ignoreSE, BOOL_32 isDepthSampleOrder,
|
||||
UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
|
||||
ADDR_TILEINFO* pTileInfo,
|
||||
UINT_32* pBitPosition) const;
|
||||
|
||||
VOID ComputeSurfaceCoordFromAddrMacroTiled(
|
||||
UINT_64 addr, UINT_32 bitPosition,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
AddrTileMode tileMode, UINT_32 tileBase, UINT_32 compBits,
|
||||
AddrTileType microTileType, BOOL_32 ignoreSE, BOOL_32 isDepthSampleOrder,
|
||||
UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
|
||||
ADDR_TILEINFO* pTileInfo,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample) const;
|
||||
|
||||
/// Fmask functions
|
||||
UINT_64 DispatchComputeFmaskAddrFromCoord(
|
||||
const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
|
||||
|
||||
VOID DispatchComputeFmaskCoordFromAddr(
|
||||
const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn,
|
||||
ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) const;
|
||||
|
||||
// FMASK related methods - private
|
||||
UINT_64 ComputeFmaskAddrFromCoordMicroTiled(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample, UINT_32 plane,
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSamples, AddrTileMode tileMode,
|
||||
BOOL_32 resolved, UINT_32* pBitPosition) const;
|
||||
|
||||
VOID ComputeFmaskCoordFromAddrMicroTiled(
|
||||
UINT_64 addr, UINT_32 bitPosition,
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
AddrTileMode tileMode, BOOL_32 resolved,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample, UINT_32* pPlane) const;
|
||||
|
||||
VOID ComputeFmaskCoordFromAddrMacroTiled(
|
||||
UINT_64 addr, UINT_32 bitPosition,
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSamples, AddrTileMode tileMode,
|
||||
UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
|
||||
BOOL_32 ignoreSE,
|
||||
ADDR_TILEINFO* pTileInfo,
|
||||
BOOL_32 resolved,
|
||||
UINT_32* pX, UINT_32* pY, UINT_32* pSlice, UINT_32* pSample, UINT_32* pPlane) const;
|
||||
|
||||
UINT_64 ComputeFmaskAddrFromCoordMacroTiled(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 sample, UINT_32 plane,
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
AddrTileMode tileMode, UINT_32 pipeSwizzle, UINT_32 bankSwizzle,
|
||||
BOOL_32 ignoreSE,
|
||||
ADDR_TILEINFO* pTileInfo,
|
||||
BOOL_32 resolved,
|
||||
UINT_32* pBitPosition) const;
|
||||
|
||||
/// Sanity check functions
|
||||
BOOL_32 SanityCheckMacroTiled(
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
protected:
|
||||
UINT_32 m_ranks; ///< Number of ranks - MC_ARB_RAMCFG.NOOFRANK
|
||||
UINT_32 m_logicalBanks; ///< Logical banks = m_banks * m_ranks if m_banks != 16
|
||||
UINT_32 m_bankInterleave; ///< Bank interleave, as a multiple of pipe interleave size
|
||||
};
|
||||
|
||||
} // V1
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@@ -0,0 +1,346 @@
|
||||
/*
|
||||
* Copyright © 2007-2019 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
|
||||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @file siaddrlib.h
|
||||
* @brief Contains the R800Lib class definition.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __SI_ADDR_LIB_H__
|
||||
#define __SI_ADDR_LIB_H__
|
||||
|
||||
#include "addrlib1.h"
|
||||
#include "egbaddrlib.h"
|
||||
|
||||
namespace Addr
|
||||
{
|
||||
namespace V1
|
||||
{
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief Describes the information in tile mode table
|
||||
****************************************************************************************************
|
||||
*/
|
||||
struct TileConfig
|
||||
{
|
||||
AddrTileMode mode;
|
||||
AddrTileType type;
|
||||
ADDR_TILEINFO info;
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief SI specific settings structure.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
struct SiChipSettings
|
||||
{
|
||||
UINT_32 isSouthernIsland : 1;
|
||||
UINT_32 isTahiti : 1;
|
||||
UINT_32 isPitCairn : 1;
|
||||
UINT_32 isCapeVerde : 1;
|
||||
// Oland/Hainan are of GFXIP 6.0, similar with SI
|
||||
UINT_32 isOland : 1;
|
||||
UINT_32 isHainan : 1;
|
||||
|
||||
// CI
|
||||
UINT_32 isSeaIsland : 1;
|
||||
UINT_32 isBonaire : 1;
|
||||
UINT_32 isKaveri : 1;
|
||||
UINT_32 isSpectre : 1;
|
||||
UINT_32 isSpooky : 1;
|
||||
UINT_32 isKalindi : 1;
|
||||
UINT_32 isHawaii : 1;
|
||||
|
||||
// VI
|
||||
UINT_32 isVolcanicIslands : 1;
|
||||
UINT_32 isIceland : 1;
|
||||
UINT_32 isTonga : 1;
|
||||
UINT_32 isFiji : 1;
|
||||
UINT_32 isPolaris10 : 1;
|
||||
UINT_32 isPolaris11 : 1;
|
||||
UINT_32 isPolaris12 : 1;
|
||||
UINT_32 isVegaM : 1;
|
||||
UINT_32 isCarrizo : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
****************************************************************************************************
|
||||
* @brief This class is the SI specific address library
|
||||
* function set.
|
||||
****************************************************************************************************
|
||||
*/
|
||||
class SiLib : public EgBasedLib
|
||||
{
|
||||
public:
|
||||
/// Creates SiLib object
|
||||
static Addr::Lib* CreateObj(const Client* pClient)
|
||||
{
|
||||
VOID* pMem = Object::ClientAlloc(sizeof(SiLib), pClient);
|
||||
return (pMem != NULL) ? new (pMem) SiLib(pClient) : NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
SiLib(const Client* pClient);
|
||||
virtual ~SiLib();
|
||||
|
||||
// Hwl interface - defined in AddrLib1
|
||||
virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlConvertTileInfoToHW(
|
||||
const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn,
|
||||
ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_64 HwlComputeXmaskAddrFromCoord(
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 x, UINT_32 y, UINT_32 slice, UINT_32 numSlices,
|
||||
UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
|
||||
ADDR_TILEINFO* pTileInfo, UINT_32* pBitPosition) const;
|
||||
|
||||
virtual VOID HwlComputeXmaskCoordFromAddr(
|
||||
UINT_64 addr, UINT_32 bitPosition, UINT_32 pitch, UINT_32 height, UINT_32 numSlices,
|
||||
UINT_32 factor, BOOL_32 isLinear, BOOL_32 isWidth8, BOOL_32 isHeight8,
|
||||
ADDR_TILEINFO* pTileInfo, UINT_32* pX, UINT_32* pY, UINT_32* pSlice) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlGetTileIndex(
|
||||
const ADDR_GET_TILEINDEX_INPUT* pIn,
|
||||
ADDR_GET_TILEINDEX_OUTPUT* pOut) const;
|
||||
|
||||
virtual BOOL_32 HwlComputeMipLevel(
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
|
||||
|
||||
virtual ChipFamily HwlConvertChipFamily(
|
||||
UINT_32 uChipFamily, UINT_32 uChipRevision);
|
||||
|
||||
virtual BOOL_32 HwlInitGlobalParams(
|
||||
const ADDR_CREATE_INPUT* pCreateIn);
|
||||
|
||||
virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
|
||||
UINT_32 bpp, INT_32 index, INT_32 macroModeIndex,
|
||||
ADDR_TILEINFO* pInfo, AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
|
||||
|
||||
virtual VOID HwlComputeTileDataWidthAndHeightLinear(
|
||||
UINT_32* pMacroWidth, UINT_32* pMacroHeight,
|
||||
UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual UINT_64 HwlComputeHtileBytes(
|
||||
UINT_32 pitch, UINT_32 height, UINT_32 bpp,
|
||||
BOOL_32 isLinear, UINT_32 numSlices, UINT_64* pSliceBytes, UINT_32 baseAlign) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE ComputeBankEquation(
|
||||
UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
|
||||
ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
|
||||
|
||||
virtual ADDR_E_RETURNCODE ComputePipeEquation(
|
||||
UINT_32 log2BytesPP, UINT_32 threshX, UINT_32 threshY,
|
||||
ADDR_TILEINFO* pTileInfo, ADDR_EQUATION* pEquation) const;
|
||||
|
||||
virtual UINT_32 ComputePipeFromCoord(
|
||||
UINT_32 x, UINT_32 y, UINT_32 slice,
|
||||
AddrTileMode tileMode, UINT_32 pipeSwizzle, BOOL_32 ignoreSE,
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual UINT_32 HwlGetPipes(const ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
/// Pre-handler of 3x pitch (96 bit) adjustment
|
||||
virtual UINT_32 HwlPreHandleBaseLvl3xPitch(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
|
||||
/// Post-handler of 3x pitch adjustment
|
||||
virtual UINT_32 HwlPostHandleBaseLvl3xPitch(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, UINT_32 expPitch) const;
|
||||
|
||||
/// Dummy function to finalize the inheritance
|
||||
virtual UINT_32 HwlComputeXmaskCoordYFrom8Pipe(
|
||||
UINT_32 pipe, UINT_32 x) const;
|
||||
|
||||
// Sub-hwl interface - defined in EgBasedLib
|
||||
virtual VOID HwlSetupTileInfo(
|
||||
AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
|
||||
ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
|
||||
AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual UINT_32 HwlGetPitchAlignmentMicroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples) const;
|
||||
|
||||
virtual UINT_64 HwlGetSizeAdjustmentMicroTiled(
|
||||
UINT_32 thickness, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
|
||||
UINT_32 baseAlign, UINT_32 pitchAlign,
|
||||
UINT_32 *pPitch, UINT_32 *pHeight) const;
|
||||
|
||||
virtual VOID HwlCheckLastMacroTiledLvl(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
virtual BOOL_32 HwlTileInfoEqual(
|
||||
const ADDR_TILEINFO* pLeft, const ADDR_TILEINFO* pRight) const;
|
||||
|
||||
virtual AddrTileMode HwlDegradeThickTileMode(
|
||||
AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
|
||||
|
||||
virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
/// Overwrite tile setting to PRT
|
||||
virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
|
||||
|
||||
virtual BOOL_32 HwlSanityCheckMacroTiled(
|
||||
ADDR_TILEINFO* pTileInfo) const
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual UINT_32 HwlGetPitchAlignmentLinear(UINT_32 bpp, ADDR_SURFACE_FLAGS flags) const;
|
||||
|
||||
virtual UINT_64 HwlGetSizeAdjustmentLinear(
|
||||
AddrTileMode tileMode,
|
||||
UINT_32 bpp, UINT_32 numSamples, UINT_32 baseAlign, UINT_32 pitchAlign,
|
||||
UINT_32 *pPitch, UINT_32 *pHeight, UINT_32 *pHeightAlign) const;
|
||||
|
||||
virtual VOID HwlComputeSurfaceCoord2DFromBankPipe(
|
||||
AddrTileMode tileMode, UINT_32* pX, UINT_32* pY, UINT_32 slice,
|
||||
UINT_32 bank, UINT_32 pipe,
|
||||
UINT_32 bankSwizzle, UINT_32 pipeSwizzle, UINT_32 tileSlices,
|
||||
BOOL_32 ignoreSE,
|
||||
ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual UINT_32 HwlPreAdjustBank(
|
||||
UINT_32 tileX, UINT_32 bank, ADDR_TILEINFO* pTileInfo) const;
|
||||
|
||||
virtual INT_32 HwlPostCheckTileIndex(
|
||||
const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
|
||||
INT curIndex = TileIndexInvalid) const;
|
||||
|
||||
virtual VOID HwlFmaskPreThunkSurfInfo(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
|
||||
const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
|
||||
ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
|
||||
ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
|
||||
|
||||
virtual VOID HwlFmaskPostThunkSurfInfo(
|
||||
const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
|
||||
ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
|
||||
|
||||
virtual UINT_32 HwlComputeFmaskBits(
|
||||
const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
|
||||
UINT_32* pNumSamples) const;
|
||||
|
||||
virtual BOOL_32 HwlReduceBankWidthHeight(
|
||||
UINT_32 tileSize, UINT_32 bpp, ADDR_SURFACE_FLAGS flags, UINT_32 numSamples,
|
||||
UINT_32 bankHeightAlign, UINT_32 pipes,
|
||||
ADDR_TILEINFO* pTileInfo) const
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual UINT_32 HwlComputeMaxBaseAlignments() const;
|
||||
|
||||
virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
|
||||
|
||||
virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
|
||||
AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
|
||||
UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
|
||||
|
||||
// Get equation table pointer and number of equations
|
||||
virtual UINT_32 HwlGetEquationTableInfo(const ADDR_EQUATION** ppEquationTable) const
|
||||
{
|
||||
*ppEquationTable = m_equationTable;
|
||||
|
||||
return m_numEquations;
|
||||
}
|
||||
|
||||
// Check if it is supported for given bpp and tile config to generate an equation
|
||||
BOOL_32 IsEquationSupported(
|
||||
UINT_32 bpp, TileConfig tileConfig, INT_32 tileIndex, UINT_32 elementBytesLog2) const;
|
||||
|
||||
// Protected non-virtual functions
|
||||
VOID ComputeTileCoordFromPipeAndElemIdx(
|
||||
UINT_32 elemIdx, UINT_32 pipe, AddrPipeCfg pipeCfg, UINT_32 pitchInMacroTile,
|
||||
UINT_32 x, UINT_32 y, UINT_32* pX, UINT_32* pY) const;
|
||||
|
||||
UINT_32 TileCoordToMaskElementIndex(
|
||||
UINT_32 tx, UINT_32 ty, AddrPipeCfg pipeConfig,
|
||||
UINT_32 *macroShift, UINT_32 *elemIdxBits) const;
|
||||
|
||||
BOOL_32 DecodeGbRegs(
|
||||
const ADDR_REGISTER_VALUE* pRegValue);
|
||||
|
||||
const TileConfig* GetTileSetting(
|
||||
UINT_32 index) const;
|
||||
|
||||
// Initialize equation table
|
||||
VOID InitEquationTable();
|
||||
|
||||
UINT_32 GetPipePerSurf(AddrPipeCfg pipeConfig) const;
|
||||
|
||||
static const UINT_32 TileTableSize = 32;
|
||||
TileConfig m_tileTable[TileTableSize];
|
||||
UINT_32 m_noOfEntries;
|
||||
|
||||
// Max number of bpp (8bpp/16bpp/32bpp/64bpp/128bpp)
|
||||
static const UINT_32 MaxNumElementBytes = 5;
|
||||
|
||||
static const BOOL_32 m_EquationSupport[TileTableSize][MaxNumElementBytes];
|
||||
|
||||
// Prt tile mode index mask
|
||||
static const UINT_32 SiPrtTileIndexMask = ((1 << 3) | (1 << 5) | (1 << 6) | (1 << 7) |
|
||||
(1 << 21) | (1 << 22) | (1 << 23) | (1 << 24) |
|
||||
(1 << 25) | (1 << 30));
|
||||
|
||||
// More than half slots in tile mode table can't support equation
|
||||
static const UINT_32 EquationTableSize = (MaxNumElementBytes * TileTableSize) / 2;
|
||||
// Equation table
|
||||
ADDR_EQUATION m_equationTable[EquationTableSize];
|
||||
UINT_32 m_numMacroBits[EquationTableSize];
|
||||
UINT_32 m_blockWidth[EquationTableSize];
|
||||
UINT_32 m_blockHeight[EquationTableSize];
|
||||
UINT_32 m_blockSlices[EquationTableSize];
|
||||
// Number of equation entries in the table
|
||||
UINT_32 m_numEquations;
|
||||
// Equation lookup table according to bpp and tile index
|
||||
UINT_32 m_equationLookupTable[MaxNumElementBytes][TileTableSize];
|
||||
|
||||
UINT_32 m_uncompressDepthEqIndex;
|
||||
|
||||
SiChipSettings m_settings;
|
||||
|
||||
private:
|
||||
|
||||
VOID ReadGbTileMode(UINT_32 regValue, TileConfig* pCfg) const;
|
||||
BOOL_32 InitTileSettingTable(const UINT_32 *pSetting, UINT_32 noOfEntries);
|
||||
};
|
||||
|
||||
} // V1
|
||||
} // Addr
|
||||
|
||||
#endif
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren