mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
freedreno+turnip: Get device name from device-info table
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
This commit is contained in:
parent
a4559c9550
commit
7c7722304b
6 changed files with 43 additions and 26 deletions
|
|
@ -38,3 +38,14 @@ fd_dev_info(uint32_t gpu_id)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
fd_dev_name(uint32_t gpu_id)
|
||||
{
|
||||
for (int i = 0; i < fd_dev_ids_count; i++) {
|
||||
if (gpu_id == fd_dev_ids[i].gpu_id) {
|
||||
return fd_dev_ids[i].name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ struct fd_dev_info {
|
|||
|
||||
struct fd_dev_id {
|
||||
uint32_t gpu_id;
|
||||
const char *name;
|
||||
const struct fd_dev_info *info;
|
||||
};
|
||||
|
||||
|
|
@ -122,6 +123,7 @@ struct fd_dev_id {
|
|||
#define A6XX_CCU_GMEM_COLOR_SIZE (16 * 1024)
|
||||
|
||||
const struct fd_dev_info * fd_dev_info(uint32_t gpu_id);
|
||||
const char * fd_dev_name(uint32_t gpu_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
|
|
|
|||
|
|
@ -51,6 +51,13 @@ def add_gpus(ids, info):
|
|||
for id in ids:
|
||||
s.gpus[id] = info
|
||||
|
||||
class GPUId(object):
|
||||
def __init__(self, gpu_id, name=None):
|
||||
self.gpu_id = gpu_id
|
||||
if name == None:
|
||||
name = "FD%d" % gpu_id
|
||||
self.name = name
|
||||
|
||||
class Struct(object):
|
||||
"""A helper class that stringifies itself to a 'C' struct initializer
|
||||
"""
|
||||
|
|
@ -123,10 +130,10 @@ class A6xxGPUInfo(GPUInfo):
|
|||
# a2xx is really two sub-generations, a20x and a22x, but we don't currently
|
||||
# capture that in the device-info tables
|
||||
add_gpus([
|
||||
200,
|
||||
201,
|
||||
205,
|
||||
220,
|
||||
GPUId(200),
|
||||
GPUId(201),
|
||||
GPUId(205),
|
||||
GPUId(220),
|
||||
], GPUInfo(
|
||||
gmem_align_w = 32, gmem_align_h = 32,
|
||||
tile_align_w = 32, tile_align_h = 32,
|
||||
|
|
@ -136,10 +143,10 @@ add_gpus([
|
|||
))
|
||||
|
||||
add_gpus([
|
||||
305,
|
||||
307,
|
||||
320,
|
||||
330,
|
||||
GPUId(305),
|
||||
GPUId(307),
|
||||
GPUId(320),
|
||||
GPUId(330),
|
||||
], GPUInfo(
|
||||
gmem_align_w = 32, gmem_align_h = 32,
|
||||
tile_align_w = 32, tile_align_h = 32,
|
||||
|
|
@ -149,9 +156,9 @@ add_gpus([
|
|||
))
|
||||
|
||||
add_gpus([
|
||||
405,
|
||||
420,
|
||||
430,
|
||||
GPUId(405),
|
||||
GPUId(420),
|
||||
GPUId(430),
|
||||
], GPUInfo(
|
||||
gmem_align_w = 32, gmem_align_h = 32,
|
||||
tile_align_w = 32, tile_align_h = 32,
|
||||
|
|
@ -161,9 +168,9 @@ add_gpus([
|
|||
))
|
||||
|
||||
add_gpus([
|
||||
510,
|
||||
530,
|
||||
540,
|
||||
GPUId(510),
|
||||
GPUId(530),
|
||||
GPUId(540),
|
||||
], GPUInfo(
|
||||
gmem_align_w = 64, gmem_align_h = 32,
|
||||
tile_align_w = 64, tile_align_h = 32,
|
||||
|
|
@ -206,8 +213,8 @@ a6xx_gen3 = dict(
|
|||
)
|
||||
|
||||
add_gpus([
|
||||
615,
|
||||
618,
|
||||
GPUId(615),
|
||||
GPUId(618),
|
||||
], A6xxGPUInfo(
|
||||
a6xx_gen1,
|
||||
num_sp_cores = 1,
|
||||
|
|
@ -218,7 +225,7 @@ add_gpus([
|
|||
))
|
||||
|
||||
add_gpus([
|
||||
630,
|
||||
GPUId(630),
|
||||
], A6xxGPUInfo(
|
||||
a6xx_gen1,
|
||||
num_sp_cores = 2,
|
||||
|
|
@ -229,7 +236,7 @@ add_gpus([
|
|||
))
|
||||
|
||||
add_gpus([
|
||||
640,
|
||||
GPUId(640),
|
||||
], A6xxGPUInfo(
|
||||
a6xx_gen2,
|
||||
num_sp_cores = 2,
|
||||
|
|
@ -240,7 +247,7 @@ add_gpus([
|
|||
))
|
||||
|
||||
add_gpus([
|
||||
650,
|
||||
GPUId(650),
|
||||
], A6xxGPUInfo(
|
||||
a6xx_gen3,
|
||||
num_sp_cores = 3,
|
||||
|
|
@ -285,7 +292,7 @@ static const struct fd_dev_info __info${s.info_index(info)} = ${str(info)};
|
|||
|
||||
const struct fd_dev_id fd_dev_ids[] = {
|
||||
%for id, info in s.gpus.items():
|
||||
{ ${id}, &__info${s.info_index(info)} },
|
||||
{ ${id.gpu_id}, "${id.name}", &__info${s.info_index(info)} },
|
||||
%endfor
|
||||
};
|
||||
const unsigned fd_dev_ids_count = ${len(s.gpus)};
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ tu_physical_device_init(struct tu_physical_device *device,
|
|||
{
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
memset(device->name, 0, sizeof(device->name));
|
||||
sprintf(device->name, "FD%d", device->gpu_id);
|
||||
device->name = fd_dev_name(device->gpu_id);
|
||||
|
||||
const struct fd_dev_info *info = fd_dev_info(device->gpu_id);
|
||||
if (!info) {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ struct tu_physical_device
|
|||
|
||||
struct tu_instance *instance;
|
||||
|
||||
char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
|
||||
const char *name;
|
||||
uint8_t driver_uuid[VK_UUID_SIZE];
|
||||
uint8_t device_uuid[VK_UUID_SIZE];
|
||||
uint8_t cache_uuid[VK_UUID_SIZE];
|
||||
|
|
|
|||
|
|
@ -107,9 +107,7 @@ bool fd_binning_enabled = true;
|
|||
static const char *
|
||||
fd_screen_get_name(struct pipe_screen *pscreen)
|
||||
{
|
||||
static char buffer[128];
|
||||
snprintf(buffer, sizeof(buffer), "FD%03d", fd_screen(pscreen)->device_id);
|
||||
return buffer;
|
||||
return fd_dev_name(fd_screen(pscreen)->gpu_id);
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue