0001
0002
0003
0004 #ifndef __LIMA_CTX_H__
0005 #define __LIMA_CTX_H__
0006
0007 #include <linux/xarray.h>
0008 #include <linux/sched.h>
0009
0010 #include "lima_device.h"
0011
0012 struct lima_ctx {
0013 struct kref refcnt;
0014 struct lima_device *dev;
0015 struct lima_sched_context context[lima_pipe_num];
0016 atomic_t guilty;
0017
0018
0019 char pname[TASK_COMM_LEN];
0020 pid_t pid;
0021 };
0022
0023 struct lima_ctx_mgr {
0024 struct mutex lock;
0025 struct xarray handles;
0026 };
0027
0028 int lima_ctx_create(struct lima_device *dev, struct lima_ctx_mgr *mgr, u32 *id);
0029 int lima_ctx_free(struct lima_ctx_mgr *mgr, u32 id);
0030 struct lima_ctx *lima_ctx_get(struct lima_ctx_mgr *mgr, u32 id);
0031 void lima_ctx_put(struct lima_ctx *ctx);
0032 void lima_ctx_mgr_init(struct lima_ctx_mgr *mgr);
0033 void lima_ctx_mgr_fini(struct lima_ctx_mgr *mgr);
0034
0035 #endif