[Mesa-dev] [PATCH] st/mesa: create framebuffer iface hash table per st manager

Charmaine Lee charmainel at vmware.com
Tue Jul 25 17:33:07 UTC 2017


>From: James Legg <jlegg at feralinteractive.com>
>Sent: Tuesday, July 25, 2017 6:24 AM
>To: mesa-dev at lists.freedesktop.org; Charmaine Lee
>Subject: Re: [Mesa-dev] [PATCH] st/mesa: create framebuffer iface hash table per st manager

>On Sun, 2017-07-23 at 16:37 -0700, Charmaine Lee wrote:
>> With this patch, framebuffer interface hash table is created
>> per state tracker manager.
>>
>> Fixes crash with steam.
>>
>> Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid->3D101876&d=DwICaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ang1qmMo4GwCmRUnLE-f31kqPa6AOnoS->OAMUzQyM0M&m=2ysMQPCeR_vf9ch72ej4wehfJ99Mtt9hBTroMbybY_o&s=xmTbTiDE9mV_SwkzVM08KH23S6vuWlerjRkqriB3>QOg&e=
>> Fixes: 5124bf98239 ("st/mesa: add destroy_drawable interface")
>> Tested-by: Christoph Haag <haagch at frickel.club>

>> --- a/src/mesa/state_tracker/st_manager.c
>>
>> @@ -511,45 +515,63 @@ st_framebuffer_iface_equal(const void *a, const void *b)
>>
>>
>>  static boolean
>> -st_framebuffer_iface_lookup(const struct st_framebuffer_iface *stfbi)
>> +st_framebuffer_iface_lookup(struct st_manager *smapi,
>> +                            const struct st_framebuffer_iface *stfbi)
>>  {
>> +   struct st_manager_private *smPriv =
>> +      (struct st_manager_private *)smapi->st_manager_private;
>>     struct hash_entry *entry;
>>
>> -   mtx_lock(&st_mutex);
>> -   entry = _mesa_hash_table_search(st_fbi_ht, stfbi);
>> -   mtx_unlock(&st_mutex);
>> +   assert(smPriv);
>> +   assert(smPriv->stfbi_ht);
>> +
>> +   mtx_lock(&smPriv->st_mutex);
>> +   entry = _mesa_hash_table_search(smPriv->stfbi_ht, stfbi);
>> +   mtx_unlock(&smPriv->st_mutex);
>>
>>     return entry != NULL;
>>  }
>>
>>
>>  static boolean
>> -st_framebuffer_iface_insert(struct st_framebuffer_iface *stfbi)
>> +st_framebuffer_iface_insert(struct st_manager *smapi,
>> +                            struct st_framebuffer_iface *stfbi)
>>  {
>> +   struct st_manager_private *smPriv =
>> +      (struct st_manager_private *)smapi->st_manager_private;
>>     struct hash_entry *entry;
>>
>> -   mtx_lock(&st_mutex);
>> -   entry = _mesa_hash_table_insert(st_fbi_ht, stfbi, stfbi);
>> -   mtx_unlock(&st_mutex);
>> +   assert(smPriv);
>> +   assert(smPriv->stfbi_ht);
>> +
>> +   mtx_lock(&smPriv->st_mutex);
>> +   entry = _mesa_hash_table_insert(smPriv->stfbi_ht, stfbi, stfbi);
>> +   mtx_unlock(&smPriv->st_mutex);
>>
>>     return entry != NULL;
>>  }
>>
>>
>>  static void
>> -st_framebuffer_iface_remove(struct st_framebuffer_iface *stfbi)
>> +st_framebuffer_iface_remove(struct st_manager *smapi,
>> +                            struct st_framebuffer_iface *stfbi)
>>  {
>> +   struct st_manager_private *smPriv =
>> +      (struct st_manager_private *)smapi->st_manager_private;
>>     struct hash_entry *entry;
>>
>> -   mtx_lock(&st_mutex);
>> -   entry = _mesa_hash_table_search(st_fbi_ht, stfbi);
>> +   if (!smPriv || !smPriv->stfbi_ht);
>> +      return;

>The semicolon after the if causes the return to execute
>unconditionally.

Ah, good catch.  Thanks.  Will fix it.

-Charmaine


More information about the mesa-dev mailing list