zink: handle signed and unsigned min/max ops in ntv
[mesa.git] / src / etnaviv / drm / etnaviv_priv.h
index a4b6a9df2549a87e7ddd9fb489645ff956ad8b15..054e6cc730e72fcece57da77abf72cbd41164fea 100644 (file)
 
 #include "util/list.h"
 #include "util/macros.h"
+#include "util/timespec.h"
 #include "util/u_atomic.h"
 #include "util/u_debug.h"
+#include "util/vma.h"
 
 #include "etnaviv_drmif.h"
 #include "drm-uapi/etnaviv_drm.h"
@@ -76,6 +78,9 @@ struct etna_device {
 
        struct etna_bo_cache bo_cache;
 
+       int use_softpin;
+       struct util_vma_heap address_space;
+
        int closefd;        /* call close(fd) upon destruction */
 };
 
@@ -97,6 +102,7 @@ struct etna_bo {
        uint32_t        flags;
        uint32_t        name;           /* flink global handle (DRI2 name) */
        uint64_t        offset;         /* offset to mmap() */
+       uint32_t        va;             /* GPU virtual address */
        int             refcnt;
 
        /*
@@ -199,10 +205,13 @@ struct etna_perfmon_signal
 static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns)
 {
        struct timespec t;
-       uint32_t s = ns / 1000000000;
        clock_gettime(CLOCK_MONOTONIC, &t);
-       tv->tv_sec = t.tv_sec + s;
-       tv->tv_nsec = t.tv_nsec + ns - (s * 1000000000);
+       tv->tv_sec = t.tv_sec + ns / NSEC_PER_SEC;
+       tv->tv_nsec = t.tv_nsec + ns % NSEC_PER_SEC;
+       if (tv->tv_nsec >= NSEC_PER_SEC) {
+               tv->tv_nsec -= NSEC_PER_SEC;
+               tv->tv_sec++;
+       }
 }
 
 #if HAVE_VALGRIND