aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-02-05 14:10:48 -0500
committerMarge Bot <[email protected]>2020-02-26 20:35:50 +0000
commita01a875081bd52bc1c3c142a60af678171ce6c33 (patch)
tree395290b39796f09ee465fda4fbbb07354c57cb26 /src/gallium/state_trackers
parent56f31328f207f310ee9b53f3294a23b25b2687e0 (diff)
gallium/hash_table: consolidate hash tables with pointer keys
Reviewed-by: Kristian H. Kristensen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3722>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/omx/tizonia/h264dprc.c14
-rw-r--r--src/gallium/state_trackers/va/context.c4
-rw-r--r--src/gallium/state_trackers/va/va_private.h10
3 files changed, 3 insertions, 25 deletions
diff --git a/src/gallium/state_trackers/omx/tizonia/h264dprc.c b/src/gallium/state_trackers/omx/tizonia/h264dprc.c
index cac62a82e72..5678bd7ac8c 100644
--- a/src/gallium/state_trackers/omx/tizonia/h264dprc.c
+++ b/src/gallium/state_trackers/omx/tizonia/h264dprc.c
@@ -46,18 +46,6 @@
unsigned dec_frame_delta;
-#define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))
-
-static unsigned handle_hash(void *key)
-{
- return PTR_TO_UINT(key);
-}
-
-static int handle_compare(void *key1, void *key2)
-{
- return PTR_TO_UINT(key1) != PTR_TO_UINT(key2);
-}
-
static enum pipe_error hash_table_clear_item_callback(void *key, void *value, void *data)
{
struct pipe_video_buffer *video_buffer = (struct pipe_video_buffer *)value;
@@ -434,7 +422,7 @@ static OMX_ERRORTYPE h264d_prc_allocate_resources(void *ap_obj, OMX_U32 a_pid)
list_inithead(&priv->codec_data.h264.dpb_list);
- priv->video_buffer_map = util_hash_table_create(handle_hash, handle_compare);
+ priv->video_buffer_map = util_hash_table_create_ptr_keys();
return OMX_ErrorNone;
}
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c
index 2cb3a6c9268..70d4bac63a7 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -302,11 +302,11 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
switch (u_reduce_video_profile(context->templat.profile)) {
case PIPE_VIDEO_FORMAT_MPEG4_AVC:
context->desc.h264enc.rate_ctrl.rate_ctrl_method = config->rc;
- context->desc.h264enc.frame_idx = util_hash_table_create(handle_hash, handle_compare);
+ context->desc.h264enc.frame_idx = util_hash_table_create_ptr_keys();
break;
case PIPE_VIDEO_FORMAT_HEVC:
context->desc.h265enc.rc.rate_ctrl_method = config->rc;
- context->desc.h265enc.frame_idx = util_hash_table_create(handle_hash, handle_compare);
+ context->desc.h265enc.frame_idx = util_hash_table_create_ptr_keys();
break;
default:
break;
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h
index bed1189b9d1..aa3b74c0b6e 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -63,16 +63,6 @@
#define SOS (8 + 4 * 2)
#define MAX_MJPEG_SLICE_HEADER_SIZE (SOI + DQT + DHT + DRI + SOF + SOS)
-static inline unsigned handle_hash(void *key)
-{
- return PTR_TO_UINT(key);
-}
-
-static inline int handle_compare(void *key1, void *key2)
-{
- return PTR_TO_UINT(key1) != PTR_TO_UINT(key2);
-}
-
static inline enum pipe_video_chroma_format
ChromaToPipe(int format)
{