summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2014-08-26 09:11:59 +0100
committerRussell King <rmk@arm.linux.org.uk>2014-08-26 19:07:41 +0100
commitaffce951808ae2c5809a74520abfdb778ea52707 (patch)
treecc76d0f20f8a2f75b131dd7e920e8441ebeaabab
parent6af9aa7f982f66e1b3e8ca683278890ba274633f (diff)
Add viv_ioctl() interface
Add a viv_ioctl() interface to provide an etnaviv version of gcoOS_DeviceControl(). This allows us to temporarily extend galcore with features that it otherwise would not have (such as my DMA buf import, and support for user memory mapping of regions marked read-only.) Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-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)
*/