mesa/st: use drawable->ID as hash for drawable_ht
Using address of drawable as hash table key will cause memory issue in this
situation:
1. drawable A with address addr is destroyed and deleted from the hash table.
2. drawable B with same address addr is created and added to the hash table
right after 1 is done.
3. st_framebuffers_purge will seach the hash table with drawable addr that
associated with each framebuffer. If drawable is not in the hash table, then
free this framebuffer.
So when drawable B is created, then the framebuffer that associated with
drawable A will not be freed in time. This will cause GTT memory leak.
Since drawable->ID is unique, this creates a hash_table_u64 to store
drawable using drawable-ID.
Another patch of this MR is a small modification for _mesa_hash_table_u64_insert
to let it return hash_entry so we can check if inserting succeed.
v2->v1:
1. Drop the modification for _mesa_hash_table_u64_insert
2. Use drawable->ID as pre-hash value for drawable_ht.
3. Remove key_hash_function of drawable_ht.
/CC @pepp @mareko @gerddie Would you mind to review this patch, thank you very much.
Edited by Julia Zhang