#include <pthread.h>
#include <xf86drm.h>
-#include <xf86atomic.h>
#include "etnaviv_priv.h"
#include "etnaviv_drmif.h"
static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER;
-drm_public struct etna_device *etna_device_new(int fd)
+struct etna_device *etna_device_new(int fd)
{
struct etna_device *dev = calloc(sizeof(*dev), 1);
if (!dev)
return NULL;
- atomic_set(&dev->refcnt, 1);
+ p_atomic_set(&dev->refcnt, 1);
dev->fd = fd;
dev->handle_table = drmHashCreate();
dev->name_table = drmHashCreate();
/* like etna_device_new() but creates it's own private dup() of the fd
* which is close()d when the device is finalized. */
-drm_public struct etna_device *etna_device_new_dup(int fd)
+struct etna_device *etna_device_new_dup(int fd)
{
int dup_fd = dup(fd);
struct etna_device *dev = etna_device_new(dup_fd);
return dev;
}
-drm_public struct etna_device *etna_device_ref(struct etna_device *dev)
+struct etna_device *etna_device_ref(struct etna_device *dev)
{
- atomic_inc(&dev->refcnt);
+ p_atomic_inc(&dev->refcnt);
return dev;
}
free(dev);
}
-drm_private void etna_device_del_locked(struct etna_device *dev)
+void etna_device_del_locked(struct etna_device *dev)
{
- if (!atomic_dec_and_test(&dev->refcnt))
+ if (!p_atomic_dec_zero(&dev->refcnt))
return;
etna_device_del_impl(dev);
}
-drm_public void etna_device_del(struct etna_device *dev)
+void etna_device_del(struct etna_device *dev)
{
- if (!atomic_dec_and_test(&dev->refcnt))
+ if (!p_atomic_dec_zero(&dev->refcnt))
return;
pthread_mutex_lock(&table_lock);
pthread_mutex_unlock(&table_lock);
}
-drm_public int etna_device_fd(struct etna_device *dev)
+int etna_device_fd(struct etna_device *dev)
{
return dev->fd;
}