aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Dänzer2017-11-30 11:52:06 -0600
committerMichel Dänzer2017-12-05 05:50:20 -0600
commitf05a2b4cb1aedb906524718db8ba2e62383f3064 (patch)
treee5dacbd15c3eacc2642441ac4d176179046a67b0 /amdgpu/amdgpu_device.c
parent5219809a3223e0328ae43a8975bfd6bf713c9ef1 (diff)
downloadexternal-libdrm-f05a2b4cb1aedb906524718db8ba2e62383f3064.tar.gz
external-libdrm-f05a2b4cb1aedb906524718db8ba2e62383f3064.tar.xz
external-libdrm-f05a2b4cb1aedb906524718db8ba2e62383f3064.zip
amdgpu: Only remember the device's marketing name
There's no point in keeping around the full table of marketing names, when amdgpu_get_marketing_name only ever returns the device's marketing name. Acked-by: Slava Abramov <slava.abramov@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'amdgpu/amdgpu_device.c')
-rw-r--r--amdgpu/amdgpu_device.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index e7aaf4fc..eb4b2745 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -130,7 +130,6 @@ static int amdgpu_get_auth(int fd, int *auth)
130 130
131static void amdgpu_device_free_internal(amdgpu_device_handle dev) 131static void amdgpu_device_free_internal(amdgpu_device_handle dev)
132{ 132{
133 const struct amdgpu_asic_id *id;
134 amdgpu_vamgr_deinit(&dev->vamgr_32); 133 amdgpu_vamgr_deinit(&dev->vamgr_32);
135 amdgpu_vamgr_deinit(&dev->vamgr); 134 amdgpu_vamgr_deinit(&dev->vamgr);
136 util_hash_table_destroy(dev->bo_flink_names); 135 util_hash_table_destroy(dev->bo_flink_names);
@@ -140,12 +139,7 @@ static void amdgpu_device_free_internal(amdgpu_device_handle dev)
140 close(dev->fd); 139 close(dev->fd);
141 if ((dev->flink_fd >= 0) && (dev->fd != dev->flink_fd)) 140 if ((dev->flink_fd >= 0) && (dev->fd != dev->flink_fd))
142 close(dev->flink_fd); 141 close(dev->flink_fd);
143 if (dev->asic_ids) { 142 free(dev->marketing_name);
144 for (id = dev->asic_ids; id->did; id++)
145 free(id->marketing_name);
146
147 free(dev->asic_ids);
148 }
149 free(dev); 143 free(dev);
150} 144}
151 145
@@ -280,7 +274,7 @@ int amdgpu_device_initialize(int fd,
280 amdgpu_vamgr_init(&dev->vamgr, start, max, 274 amdgpu_vamgr_init(&dev->vamgr, start, max,
281 dev->dev_info.virtual_address_alignment); 275 dev->dev_info.virtual_address_alignment);
282 276
283 amdgpu_parse_asic_ids(&dev->asic_ids); 277 amdgpu_parse_asic_ids(dev);
284 278
285 *major_version = dev->major_version; 279 *major_version = dev->major_version;
286 *minor_version = dev->minor_version; 280 *minor_version = dev->minor_version;
@@ -306,16 +300,5 @@ int amdgpu_device_deinitialize(amdgpu_device_handle dev)
306 300
307const char *amdgpu_get_marketing_name(amdgpu_device_handle dev) 301const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
308{ 302{
309 const struct amdgpu_asic_id *id; 303 return dev->marketing_name;
310
311 if (!dev->asic_ids)
312 return NULL;
313
314 for (id = dev->asic_ids; id->did; id++) {
315 if ((id->did == dev->info.asic_id) &&
316 (id->rid == dev->info.pci_rev_id))
317 return id->marketing_name;
318 }
319
320 return NULL;
321} 304}