From 0bdc516fcd3e5e350a38a2cd59b9b752b9d80752 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 12 Sep 2014 16:02:43 +0100 Subject: 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 --- src/gal_extension.h | 26 ++++++++++++++++++++++++-- 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 /* 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 #include #include +#include #include #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; } -- cgit v1.2.3