summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/etnaviv/viv.c33
-rw-r--r--src/etnaviv/viv.h6
2 files changed, 27 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)
diff --git a/src/etnaviv/viv.h b/src/etnaviv/viv.h
index 8aaf01e..a8daf47 100644
--- a/src/etnaviv/viv.h
+++ b/src/etnaviv/viv.h
@@ -214,6 +214,12 @@ struct _gcsQUEUE;
*/
int viv_open(enum viv_hw_type hw_type, struct viv_conn **out);
+/* Almost raw ioctl interface. This provides an interface similar to
+ * gcoOS_DeviceControl.
+ * @returns standard ioctl semantics
+ */
+int viv_ioctl(struct viv_conn *conn, int request, void *data, size_t size);
+
/* Call ioctl interface with structure cmd as input and output.
* @returns status (gcvSTATUS_xxx)
*/