aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'etnaviv/etnaviv_bo.c')
-rw-r--r--etnaviv/etnaviv_bo.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/etnaviv/etnaviv_bo.c b/etnaviv/etnaviv_bo.c
index 4ad0434e..32f7b348 100644
--- a/etnaviv/etnaviv_bo.c
+++ b/etnaviv/etnaviv_bo.c
@@ -24,10 +24,6 @@
24 * Christian Gmeiner <christian.gmeiner@gmail.com> 24 * Christian Gmeiner <christian.gmeiner@gmail.com>
25 */ 25 */
26 26
27#ifdef HAVE_CONFIG_H
28# include <config.h>
29#endif
30
31#include "etnaviv_priv.h" 27#include "etnaviv_priv.h"
32#include "etnaviv_drmif.h" 28#include "etnaviv_drmif.h"
33 29
@@ -173,7 +169,7 @@ struct etna_bo *etna_bo_from_name(struct etna_device *dev, uint32_t name)
173 pthread_mutex_lock(&table_lock); 169 pthread_mutex_lock(&table_lock);
174 170
175 /* check name table first, to see if bo is already open: */ 171 /* check name table first, to see if bo is already open: */
176 bo = lookup_bo(dev->name_table, req.handle); 172 bo = lookup_bo(dev->name_table, name);
177 if (bo) 173 if (bo)
178 goto out_unlock; 174 goto out_unlock;
179 175
@@ -206,10 +202,15 @@ struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd)
206 int ret, size; 202 int ret, size;
207 uint32_t handle; 203 uint32_t handle;
208 204
205 /* take the lock before calling drmPrimeFDToHandle to avoid
206 * racing against etna_bo_del, which might invalidate the
207 * returned handle.
208 */
209 pthread_mutex_lock(&table_lock); 209 pthread_mutex_lock(&table_lock);
210 210
211 ret = drmPrimeFDToHandle(dev->fd, fd, &handle); 211 ret = drmPrimeFDToHandle(dev->fd, fd, &handle);
212 if (ret) { 212 if (ret) {
213 pthread_mutex_unlock(&table_lock);
213 return NULL; 214 return NULL;
214 } 215 }
215 216