dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm] xf86drmHash: remove redundant zero init
@ 2018-10-11 23:18 Rob Clark
  2018-10-12 10:53 ` [Mesa-dev] " Eric Engestrom
  2018-10-12 13:04 ` Emil Velikov
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Clark @ 2018-10-11 23:18 UTC (permalink / raw)
  To: dri-devel, mesa-dev; +Cc: Rob Clark

From: Rob Clark <robclark@freedesktop.org>

drmMalloc() is already calloc()

Signed-off-by: Rob Clark <robclark@freedesktop.org>
---
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(-)

diff --git a/xf86drmHash.c b/xf86drmHash.c
index b2fa414e..39900e7e 100644
--- a/xf86drmHash.c
+++ b/xf86drmHash.c
@@ -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;
 }
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Mesa-dev] [PATCH libdrm] xf86drmHash: remove redundant zero init
  2018-10-11 23:18 [PATCH libdrm] xf86drmHash: remove redundant zero init Rob Clark
@ 2018-10-12 10:53 ` Eric Engestrom
  2018-10-12 13:04 ` Emil Velikov
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Engestrom @ 2018-10-12 10:53 UTC (permalink / raw)
  To: Rob Clark; +Cc: mesa-dev, dri-devel

On Thursday, 2018-10-11 19:18:10 -0400, mesa-dev-bounces@lists.freedesktop.org wrote:
> From: Rob Clark <robclark@freedesktop.org>
> 
> drmMalloc() is already calloc()

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

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

> 
> Signed-off-by: Rob Clark <robclark@freedesktop.org>
> ---
> 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(-)
> 
> diff --git a/xf86drmHash.c b/xf86drmHash.c
> index b2fa414e..39900e7e 100644
> --- a/xf86drmHash.c
> +++ b/xf86drmHash.c
> @@ -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;
>  }
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH libdrm] xf86drmHash: remove redundant zero init
  2018-10-11 23:18 [PATCH libdrm] xf86drmHash: remove redundant zero init Rob Clark
  2018-10-12 10:53 ` [Mesa-dev] " Eric Engestrom
@ 2018-10-12 13:04 ` Emil Velikov
  1 sibling, 0 replies; 3+ messages in thread
From: Emil Velikov @ 2018-10-12 13:04 UTC (permalink / raw)
  To: Rob Clark; +Cc: ML mesa-dev, Rob Clark, ML dri-devel

On Fri, 12 Oct 2018 at 00:18, Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robclark@freedesktop.org>
>
> drmMalloc() is already calloc()
>
> Signed-off-by: Rob Clark <robclark@freedesktop.org>
For the patch
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

> ---
> 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.

> 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
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-12 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-11 23:18 [PATCH libdrm] xf86drmHash: remove redundant zero init Rob Clark
2018-10-12 10:53 ` [Mesa-dev] " Eric Engestrom
2018-10-12 13:04 ` Emil Velikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox