diff options
author | Russell King <rmk@arm.linux.org.uk> | 2014-09-12 16:02:43 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2014-09-12 16:15:16 +0100 |
commit | 0bdc516fcd3e5e350a38a2cd59b9b752b9d80752 (patch) | |
tree | 2ed77cc8748f813076a98badc27636e20aa8f1e3 /src | |
parent | dbcb528c4089cca8580b05e82af14663465b6ae8 (diff) |
vivante: add updated gal extension
Work on etnaviv has standardised this extension. Use the new version
instead, obsoleting the old version.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/gal_extension.h | 26 | ||||
-rw-r--r-- | src/vivante_utils.c | 9 |
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; } |