Skip to contentSkip to conversation

xf86drmHash: remove redundant zero init

PATCH In review Rob Clark 3 participants 3 messages Oct 11, 2018 – Oct 12, 2018

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 xf86drmHash: remove redundant zero init

From: Rob Clark <[email protected]>

drmMalloc() is already calloc()

---
Small micro-optimization that I noticed while doing some perf work.. I should probably look at promoting amdgpu's handle_table to core libdrm and replacing a couple of libdrm_freedreno's xf86drmHash tables over to that. There is still at least one hashtable (in some libdrm_freedreno patches I'm working on finalizing) where handle_table would not be appropriate (ie. key is a ptr).. but the answer there might be importing a better hashtable implementation into libdrm.

Related note, once I land a libdrm_freedreno patchset (hopefully tomorrow or over the weekend), I'll have interest in making a libdrm release so I can start landing mesa patches that will depend on that.. so if anyone else wants me to wait a few days so they can push something before the next libdrm release, please let me know.

 xf86drmHash.c | 5 -----
 1 file changed, 5 deletions(-)
xf86drmHash.c +0 -5
index b2fa414e..39900e7e 100644
@@ -109,12 +109,7 @@ void *drmHashCreate(void)
     table           = drmMalloc(sizeof(*table));
     if (!table) return NULL;
     table->magic    = HASH_MAGIC;
-    table->entries  = 0;
-    table->hits     = 0;
-    table->partials = 0;
-    table->misses   = 0;
 
-    for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL;
     return table;
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · On Thursday, 2018-10-11 19:18:10 -0400, [email protected]…

From: Rob Clark <[email protected]>

drmMalloc() is already calloc()

Sounds very much like an implementation detail, but everything relies on it already, so...

Quoted 46 lines

---
Small micro-optimization that I noticed while doing some perf work.. I should probably look at promoting amdgpu's handle_table to core libdrm and replacing a couple of libdrm_freedreno's xf86drmHash tables over to that. There is still at least one hashtable (in some libdrm_freedreno patches I'm working on finalizing) where handle_table would not be appropriate (ie. key is a ptr).. but the answer there might be importing a better hashtable implementation into libdrm.

Related note, once I land a libdrm_freedreno patchset (hopefully tomorrow or over the weekend), I'll have interest in making a libdrm release so I can start landing mesa patches that will depend on that.. so if anyone else wants me to wait a few days so they can push something before the next libdrm release, please let me know.

 xf86drmHash.c | 5 -----
 1 file changed, 5 deletions(-)
xf86drmHash.c +0 -5
index b2fa414e..39900e7e 100644
@@ -109,12 +109,7 @@ void *drmHashCreate(void)
     table           = drmMalloc(sizeof(*table));
     if (!table) return NULL;
     table->magic    = HASH_MAGIC;
-    table->entries  = 0;
-    table->hits     = 0;
-    table->partials = 0;
-    table->misses   = 0;
 
-    for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL;
     return table;
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Rob Clark
Quoted 6 lines · Rob Clark

From: Rob Clark <[email protected]>

drmMalloc() is already calloc()

For the patch

Quoted 10 lines

---
Small micro-optimization that I noticed while doing some perf work.. I should probably look at promoting amdgpu's handle_table to core libdrm and replacing a couple of libdrm_freedreno's xf86drmHash tables over to that. There is still at least one hashtable (in some libdrm_freedreno patches I'm working on finalizing) where handle_table would not be appropriate (ie. key is a ptr).. but the answer there might be importing a better hashtable implementation into libdrm.

Please remember to nuke some of the existing hash implementations, if you want to add new one.
The more (nuked) the better.

Quoted 7 lines

Related note, once I land a libdrm_freedreno patchset (hopefully tomorrow or over the weekend), I'll have interest in making a libdrm release so I can start landing mesa patches that will depend on that.. so if anyone else wants me to wait a few days so they can push something before the next libdrm release, please let me know.

There's nothing urgent on my end.

Thanks
Emil
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev