2017-05-11 10:19:26 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2017 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* 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 AC_GPU_INFO_H
|
|
|
|
#define AC_GPU_INFO_H
|
|
|
|
|
2017-07-12 18:45:25 -04:00
|
|
|
#include <stddef.h>
|
2017-06-16 19:10:25 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2017-05-11 10:19:26 +02:00
|
|
|
#include "amd_family.h"
|
|
|
|
|
2017-05-13 22:59:19 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-05-29 14:50:47 +01:00
|
|
|
struct amdgpu_gpu_info;
|
|
|
|
|
2017-05-11 10:19:26 +02:00
|
|
|
struct radeon_info {
|
|
|
|
/* PCI info: domain:bus:dev:func */
|
|
|
|
uint32_t pci_domain;
|
|
|
|
uint32_t pci_bus;
|
|
|
|
uint32_t pci_dev;
|
|
|
|
uint32_t pci_func;
|
|
|
|
|
|
|
|
/* Device info. */
|
2018-08-02 22:21:02 -04:00
|
|
|
const char *name;
|
2019-02-12 12:14:15 -05:00
|
|
|
const char *marketing_name;
|
2019-02-12 12:19:33 -05:00
|
|
|
bool is_pro_graphics;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t pci_id;
|
|
|
|
enum radeon_family family;
|
|
|
|
enum chip_class chip_class;
|
2019-06-19 21:47:46 -04:00
|
|
|
uint32_t family_id;
|
|
|
|
uint32_t chip_external_rev;
|
2019-02-07 00:04:32 -05:00
|
|
|
bool has_graphics; /* false if the chip is compute-only */
|
2018-03-19 19:12:15 -04:00
|
|
|
uint32_t num_compute_rings;
|
|
|
|
uint32_t num_sdma_rings;
|
|
|
|
uint32_t clock_crystal_freq;
|
|
|
|
uint32_t tcc_cache_line_size;
|
2019-08-02 12:10:43 +02:00
|
|
|
bool has_clear_state;
|
2019-08-02 12:13:20 +02:00
|
|
|
bool has_distributed_tess;
|
2019-08-02 12:16:54 +02:00
|
|
|
bool has_dcc_constant_encode;
|
2019-08-02 12:21:04 +02:00
|
|
|
bool has_rbplus; /* if RB+ registers exist */
|
2019-08-20 17:15:46 +02:00
|
|
|
bool has_load_ctx_reg_pkt;
|
2019-08-20 17:16:41 +02:00
|
|
|
bool has_out_of_order_rast;
|
2019-08-20 17:20:42 +02:00
|
|
|
bool cpdma_prefetch_writes_memory;
|
2018-03-19 19:12:15 -04:00
|
|
|
|
2019-01-04 19:39:01 -05:00
|
|
|
/* There are 2 display DCC codepaths, because display expects unaligned DCC. */
|
2019-01-04 19:19:54 -05:00
|
|
|
/* Disable RB and pipe alignment to skip the retile blit. (1 RB chips only) */
|
|
|
|
bool use_display_dcc_unaligned;
|
2019-01-04 19:39:01 -05:00
|
|
|
/* Allocate both aligned and unaligned DCC and use the retile blit. */
|
|
|
|
bool use_display_dcc_with_retile_blit;
|
2019-01-04 19:19:54 -05:00
|
|
|
|
2018-03-19 19:12:15 -04:00
|
|
|
/* Memory info. */
|
2017-05-23 18:40:18 +02:00
|
|
|
uint32_t pte_fragment_size;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t gart_page_size;
|
|
|
|
uint64_t gart_size;
|
|
|
|
uint64_t vram_size;
|
|
|
|
uint64_t vram_vis_size;
|
2016-09-11 21:53:20 +02:00
|
|
|
unsigned gds_size;
|
|
|
|
unsigned gds_gfx_partition_size;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint64_t max_alloc_size;
|
|
|
|
uint32_t min_alloc_size;
|
2018-02-02 18:22:15 +01:00
|
|
|
uint32_t address32_hi;
|
2017-05-11 10:19:26 +02:00
|
|
|
bool has_dedicated_vram;
|
2018-03-19 18:42:32 -04:00
|
|
|
bool r600_has_virtual_memory;
|
2018-03-19 19:12:15 -04:00
|
|
|
|
|
|
|
/* CP info. */
|
2017-05-11 10:19:26 +02:00
|
|
|
bool gfx_ib_pad_with_type2;
|
2018-03-06 19:07:58 -05:00
|
|
|
unsigned ib_start_alignment;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t me_fw_version;
|
2017-08-26 00:33:14 +02:00
|
|
|
uint32_t me_fw_feature;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t pfp_fw_version;
|
2017-08-26 00:33:14 +02:00
|
|
|
uint32_t pfp_fw_feature;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t ce_fw_version;
|
2017-08-26 00:33:14 +02:00
|
|
|
uint32_t ce_fw_feature;
|
2018-03-19 19:12:15 -04:00
|
|
|
|
|
|
|
/* Multimedia info. */
|
|
|
|
bool has_hw_decode;
|
|
|
|
bool uvd_enc_supported;
|
|
|
|
uint32_t uvd_fw_version;
|
|
|
|
uint32_t vce_fw_version;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t vce_harvest_config;
|
|
|
|
|
2018-05-02 18:59:54 -04:00
|
|
|
/* Kernel & winsys capabilities. */
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t drm_major; /* version */
|
|
|
|
uint32_t drm_minor;
|
|
|
|
uint32_t drm_patchlevel;
|
2019-06-11 22:49:18 -04:00
|
|
|
bool is_amdgpu;
|
2017-05-11 10:19:26 +02:00
|
|
|
bool has_userptr;
|
2017-06-05 01:54:52 +01:00
|
|
|
bool has_syncobj;
|
2017-12-28 15:59:19 +01:00
|
|
|
bool has_syncobj_wait_for_submit;
|
2018-01-04 00:19:41 +01:00
|
|
|
bool has_fence_to_handle;
|
2017-10-20 18:02:16 -04:00
|
|
|
bool has_ctx_priority;
|
2018-03-15 15:58:57 -04:00
|
|
|
bool has_local_buffers;
|
2018-05-02 18:27:18 -04:00
|
|
|
bool kernel_flushes_hdp_before_ib;
|
2018-05-02 18:35:27 -04:00
|
|
|
bool htile_cmask_support_1d_tiling;
|
2018-05-02 18:39:04 -04:00
|
|
|
bool si_TA_CS_BC_BASE_ADDR_allowed;
|
2018-05-02 18:44:08 -04:00
|
|
|
bool has_bo_metadata;
|
2018-05-02 18:53:24 -04:00
|
|
|
bool has_gpu_reset_status_query;
|
2018-05-02 18:59:54 -04:00
|
|
|
bool has_eqaa_surface_allocator;
|
2018-05-02 19:04:10 -04:00
|
|
|
bool has_format_bc1_through_bc7;
|
2018-05-02 19:11:37 -04:00
|
|
|
bool kernel_flushes_tc_l2_after_ib;
|
2018-05-02 19:28:44 -04:00
|
|
|
bool has_indirect_compute_dispatch;
|
2018-05-02 19:39:08 -04:00
|
|
|
bool has_unaligned_shader_loads;
|
2018-05-02 19:48:37 -04:00
|
|
|
bool has_sparse_vm_mappings;
|
2018-05-02 19:54:35 -04:00
|
|
|
bool has_2d_tiling;
|
2018-05-02 20:01:39 -04:00
|
|
|
bool has_read_registers_query;
|
2019-02-04 17:48:04 -05:00
|
|
|
bool has_gds_ordered_append;
|
|
|
|
bool has_scheduled_fence_dependency;
|
2017-05-11 10:19:26 +02:00
|
|
|
|
|
|
|
/* Shader cores. */
|
|
|
|
uint32_t r600_max_quad_pipes; /* wave size / 16 */
|
|
|
|
uint32_t max_shader_clock;
|
|
|
|
uint32_t num_good_compute_units;
|
2018-08-24 22:57:17 -04:00
|
|
|
uint32_t num_good_cu_per_sh;
|
2018-06-08 19:09:02 -04:00
|
|
|
uint32_t num_tcc_blocks;
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t max_se; /* shader engines */
|
|
|
|
uint32_t max_sh_per_se; /* shader arrays per shader engine */
|
|
|
|
|
|
|
|
/* Render backends (color + depth blocks). */
|
|
|
|
uint32_t r300_num_gb_pipes;
|
|
|
|
uint32_t r300_num_z_pipes;
|
|
|
|
uint32_t r600_gb_backend_map; /* R600 harvest config */
|
|
|
|
bool r600_gb_backend_map_valid;
|
|
|
|
uint32_t r600_num_banks;
|
2018-03-21 20:02:47 -04:00
|
|
|
uint32_t gb_addr_config;
|
2019-06-05 15:04:45 -04:00
|
|
|
uint32_t pa_sc_tile_steering_override; /* CLEAR_STATE also sets this */
|
2017-05-11 10:19:26 +02:00
|
|
|
uint32_t num_render_backends;
|
|
|
|
uint32_t num_tile_pipes; /* pipe count from PIPE_CONFIG */
|
|
|
|
uint32_t pipe_interleave_bytes;
|
|
|
|
uint32_t enabled_rb_mask; /* GCN harvest config */
|
2017-07-09 20:34:04 +01:00
|
|
|
uint64_t max_alignment; /* from addrlib */
|
2018-03-19 19:12:15 -04:00
|
|
|
|
2017-05-11 10:19:26 +02:00
|
|
|
/* Tile modes. */
|
|
|
|
uint32_t si_tile_mode_array[32];
|
|
|
|
uint32_t cik_macrotile_mode_array[16];
|
|
|
|
};
|
|
|
|
|
2019-06-21 17:26:44 +01:00
|
|
|
bool ac_query_gpu_info(int fd, void *dev_p,
|
2017-05-11 14:14:06 +02:00
|
|
|
struct radeon_info *info,
|
|
|
|
struct amdgpu_gpu_info *amdinfo);
|
|
|
|
|
2017-07-12 18:45:25 -04:00
|
|
|
void ac_compute_driver_uuid(char *uuid, size_t size);
|
|
|
|
|
|
|
|
void ac_compute_device_uuid(struct radeon_info *info, char *uuid, size_t size);
|
2017-11-26 03:04:55 +01:00
|
|
|
void ac_print_gpu_info(struct radeon_info *info);
|
2018-04-23 09:56:43 +10:00
|
|
|
int ac_get_gs_table_depth(enum chip_class chip_class, enum radeon_family family);
|
2018-04-23 10:09:36 +10:00
|
|
|
void ac_get_raster_config(struct radeon_info *info,
|
|
|
|
uint32_t *raster_config_p,
|
2018-09-29 19:28:20 -04:00
|
|
|
uint32_t *raster_config_1_p,
|
|
|
|
uint32_t *se_tile_repeat_p);
|
2018-04-23 10:42:21 +10:00
|
|
|
void ac_get_harvested_configs(struct radeon_info *info,
|
|
|
|
unsigned raster_config,
|
|
|
|
unsigned *cik_raster_config_1_p,
|
|
|
|
unsigned *raster_config_se);
|
2019-07-12 12:17:11 +02:00
|
|
|
unsigned ac_get_compute_resource_limits(struct radeon_info *info,
|
|
|
|
unsigned waves_per_threadgroup,
|
|
|
|
unsigned max_waves_per_sh,
|
|
|
|
unsigned threadgroups_per_cu);
|
2018-04-23 10:16:07 +10:00
|
|
|
|
|
|
|
static inline unsigned ac_get_max_simd_waves(enum radeon_family family)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (family) {
|
|
|
|
/* These always have 8 waves: */
|
|
|
|
case CHIP_POLARIS10:
|
|
|
|
case CHIP_POLARIS11:
|
|
|
|
case CHIP_POLARIS12:
|
|
|
|
case CHIP_VEGAM:
|
|
|
|
return 8;
|
|
|
|
default:
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-01 21:16:54 +11:00
|
|
|
static inline uint32_t
|
|
|
|
ac_get_num_physical_sgprs(enum chip_class chip_class)
|
|
|
|
{
|
2019-05-14 22:16:20 -04:00
|
|
|
return chip_class >= GFX8 ? 800 : 512;
|
2019-02-01 21:16:54 +11:00
|
|
|
}
|
|
|
|
|
2017-05-13 22:59:19 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-11 10:19:26 +02:00
|
|
|
#endif /* AC_GPU_INFO_H */
|