diff options
Diffstat (limited to 'src/etnaviv/viv.c')
-rw-r--r-- | src/etnaviv/viv.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/etnaviv/viv.c b/src/etnaviv/viv.c index bf8ad53..67d41c9 100644 --- a/src/etnaviv/viv.c +++ b/src/etnaviv/viv.c @@ -94,28 +94,37 @@ static int signal_for_fence(struct viv_conn *conn, uint32_t fence) return conn->fence_signals[fence % VIV_NUM_FENCE_SIGNALS]; } -/* Call ioctl interface with structure cmd as input and output. - * @returns status (VIV_STATUS_xxx) +/* Almost raw ioctl interface. This provides an interface similar to + * gcoOS_DeviceControl. + * @returns standard ioctl semantics */ -int viv_invoke(struct viv_conn *conn, struct _gcsHAL_INTERFACE *cmd) +int viv_ioctl(struct viv_conn *conn, int request, void *data, size_t size) { vivante_ioctl_data_t ic = { #ifdef GCABI_UINT64_IOCTL_DATA - .in_buf = PTR_TO_VIV(cmd), - .in_buf_size = INTERFACE_SIZE, - .out_buf = PTR_TO_VIV(cmd), - .out_buf_size = INTERFACE_SIZE + .in_buf = PTR_TO_VIV(data), + .in_buf_size = size, + .out_buf = PTR_TO_VIV(data), + .out_buf_size = size #else - .in_buf = (void*)cmd, - .in_buf_size = INTERFACE_SIZE, - .out_buf = (void*)cmd, - .out_buf_size = INTERFACE_SIZE + .in_buf = data, + .in_buf_size = size, + .out_buf = data, + .out_buf_size = size #endif }; + return ioctl(conn->fd, request, &ic); +} + +/* Call ioctl interface with structure cmd as input and output. + * @returns status (VIV_STATUS_xxx) + */ +int viv_invoke(struct viv_conn *conn, struct _gcsHAL_INTERFACE *cmd) +{ #ifdef GCABI_HAS_HARDWARE_TYPE cmd->hardwareType = (gceHARDWARE_TYPE)conn->hw_type; #endif - if(ioctl(conn->fd, IOCTL_GCHAL_INTERFACE, &ic) < 0) + if(viv_ioctl(conn, IOCTL_GCHAL_INTERFACE, cmd, INTERFACE_SIZE) < 0) return -1; #ifdef DEBUG if(cmd->status != 0) |