FD_CTX_FAULTS, /* # of per context faults */
FD_GLOBAL_FAULTS, /* # of global (all context) faults */
FD_SUSPEND_COUNT, /* # of times the GPU has suspended, and potentially lost state */
+ FD_SYSPROF, /* Settable (for CAP_SYS_ADMIN) param for system profiling */
};
/**
const struct fd_dev_id * fd_pipe_dev_id(struct fd_pipe *pipe);
int fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param,
uint64_t *value);
+int fd_pipe_set_param(struct fd_pipe *pipe, enum fd_param_id param,
+ uint64_t value);
int fd_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence);
/* timeout in nanosec */
int fd_pipe_wait_timeout(struct fd_pipe *pipe, const struct fd_fence *fence,
return pipe->funcs->get_param(pipe, param, value);
}
+int
+fd_pipe_set_param(struct fd_pipe *pipe, enum fd_param_id param, uint64_t value)
+{
+ return pipe->funcs->set_param(pipe, param, value);
+}
+
const struct fd_dev_id *
fd_pipe_dev_id(struct fd_pipe *pipe)
{
int (*get_param)(struct fd_pipe *pipe, enum fd_param_id param,
uint64_t *value);
+ int (*set_param)(struct fd_pipe *pipe, enum fd_param_id param,
+ uint64_t value);
int (*wait)(struct fd_pipe *pipe, const struct fd_fence *fence,
uint64_t timeout);
void (*destroy)(struct fd_pipe *pipe);
}
static int
+set_param(struct fd_pipe *pipe, uint32_t param, uint64_t value)
+{
+ struct msm_pipe *msm_pipe = to_msm_pipe(pipe);
+ struct drm_msm_param req = {
+ .pipe = msm_pipe->pipe,
+ .param = param,
+ .value = value,
+ };
+
+ return drmCommandWriteRead(pipe->dev->fd, DRM_MSM_SET_PARAM,
+ &req, sizeof(req));
+}
+
+static int
+msm_pipe_set_param(struct fd_pipe *pipe, enum fd_param_id param, uint64_t value)
+{
+ switch (param) {
+ case FD_SYSPROF:
+ return set_param(pipe, MSM_PARAM_SYSPROF, value);
+ default:
+ ERROR_MSG("invalid param id: %d", param);
+ return -1;
+ }
+}
+
+static int
msm_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence, uint64_t timeout)
{
struct fd_device *dev = pipe->dev;
.submit_new = msm_submit_sp_new,
.flush = msm_pipe_sp_flush,
.get_param = msm_pipe_get_param,
+ .set_param = msm_pipe_set_param,
.wait = msm_pipe_wait,
.destroy = msm_pipe_destroy,
};
.ringbuffer_new_object = msm_ringbuffer_new_object,
.submit_new = msm_submit_new,
.get_param = msm_pipe_get_param,
+ .set_param = msm_pipe_set_param,
.wait = msm_pipe_wait,
.destroy = msm_pipe_destroy,
};