summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gal_extension.h26
-rw-r--r--src/vivante_utils.c9
2 files changed, 30 insertions, 5 deletions
diff --git a/src/gal_extension.h b/src/gal_extension.h
index 6325444..96ac7f4 100644
--- a/src/gal_extension.h
+++ b/src/gal_extension.h
@@ -8,13 +8,35 @@
#include <gc_hal.h>
/* Map a DMABUF fd into galcore */
-struct dmabuf_map {
+struct dmabuf_map_old {
unsigned zero;
unsigned status;
int fd;
gctPOINTER Info;
gctUINT32 Address;
};
-#define IOC_GDMABUF_MAP _IOWR('_', 0, struct dmabuf_map)
+#define IOC_GDMABUF_MAP_OLD _IOWR('_', 0, struct dmabuf_map_old)
+
+union gcabi_header {
+ uint32_t padding[16];
+ struct {
+ uint32_t zero;
+ uint32_t status;
+ } v2;
+ struct {
+ uint32_t zero;
+ uint32_t hwtype;
+ uint32_t status;
+ } v4;
+};
+
+struct dmabuf_map {
+ union gcabi_header hdr;
+ uint64_t info;
+ uint64_t address;
+ int32_t fd;
+ uint32_t prot;
+};
+#define IOC_GDMABUF_MAP _IOWR('_', 0, struct dmabuf_map)
#endif
diff --git a/src/vivante_utils.c b/src/vivante_utils.c
index 2797fd6..8a61133 100644
--- a/src/vivante_utils.c
+++ b/src/vivante_utils.c
@@ -11,6 +11,7 @@
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
+#include <sys/mman.h>
#include <unistd.h>
#ifdef HAVE_DIX_CONFIG_H
@@ -133,8 +134,10 @@ Bool vivante_map_bo_to_gpu(struct vivante *vivante, struct drm_armada_bo *bo,
return FALSE;
}
- map.zero = 0;
+ map.hdr.v2.zero = 0;
+ map.hdr.v2.status = 0;
map.fd = fd;
+ map.prot = PROT_READ | PROT_WRITE;
status = vivante_ioctl(vivante, IOC_GDMABUF_MAP, &map, sizeof(map));
@@ -148,8 +151,8 @@ Bool vivante_map_bo_to_gpu(struct vivante *vivante, struct drm_armada_bo *bo,
return FALSE;
}
- *handle = map.Address;
- *info = map.Info;
+ *handle = map.address;
+ *info = (void *)(uintptr_t)map.info;
return TRUE;
}