freedreno/drm: Add SYSPROF param
Add new param for putting kernel in system-profiling mode and add corresponding fd_pipe_set_param() mechanism. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15236>
This commit is contained in:
parent
f925794b16
commit
af4b7f74b2
|
@ -62,6 +62,7 @@ enum fd_param_id {
|
||||||
FD_CTX_FAULTS, /* # of per context faults */
|
FD_CTX_FAULTS, /* # of per context faults */
|
||||||
FD_GLOBAL_FAULTS, /* # of global (all context) faults */
|
FD_GLOBAL_FAULTS, /* # of global (all context) faults */
|
||||||
FD_SUSPEND_COUNT, /* # of times the GPU has suspended, and potentially lost state */
|
FD_SUSPEND_COUNT, /* # of times the GPU has suspended, and potentially lost state */
|
||||||
|
FD_SYSPROF, /* Settable (for CAP_SYS_ADMIN) param for system profiling */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,6 +150,8 @@ void fd_pipe_purge(struct fd_pipe *pipe);
|
||||||
const struct fd_dev_id * fd_pipe_dev_id(struct fd_pipe *pipe);
|
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,
|
int fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param,
|
||||||
uint64_t *value);
|
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);
|
int fd_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence);
|
||||||
/* timeout in nanosec */
|
/* timeout in nanosec */
|
||||||
int fd_pipe_wait_timeout(struct fd_pipe *pipe, const struct fd_fence *fence,
|
int fd_pipe_wait_timeout(struct fd_pipe *pipe, const struct fd_fence *fence,
|
||||||
|
|
|
@ -164,6 +164,12 @@ fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param, uint64_t *value)
|
||||||
return pipe->funcs->get_param(pipe, param, value);
|
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 *
|
const struct fd_dev_id *
|
||||||
fd_pipe_dev_id(struct fd_pipe *pipe)
|
fd_pipe_dev_id(struct fd_pipe *pipe)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,6 +198,8 @@ struct fd_pipe_funcs {
|
||||||
|
|
||||||
int (*get_param)(struct fd_pipe *pipe, enum fd_param_id param,
|
int (*get_param)(struct fd_pipe *pipe, enum fd_param_id param,
|
||||||
uint64_t *value);
|
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,
|
int (*wait)(struct fd_pipe *pipe, const struct fd_fence *fence,
|
||||||
uint64_t timeout);
|
uint64_t timeout);
|
||||||
void (*destroy)(struct fd_pipe *pipe);
|
void (*destroy)(struct fd_pipe *pipe);
|
||||||
|
|
|
@ -107,6 +107,32 @@ msm_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static int
|
||||||
msm_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence, uint64_t timeout)
|
msm_pipe_wait(struct fd_pipe *pipe, const struct fd_fence *fence, uint64_t timeout)
|
||||||
{
|
{
|
||||||
|
@ -182,6 +208,7 @@ static const struct fd_pipe_funcs sp_funcs = {
|
||||||
.submit_new = msm_submit_sp_new,
|
.submit_new = msm_submit_sp_new,
|
||||||
.flush = msm_pipe_sp_flush,
|
.flush = msm_pipe_sp_flush,
|
||||||
.get_param = msm_pipe_get_param,
|
.get_param = msm_pipe_get_param,
|
||||||
|
.set_param = msm_pipe_set_param,
|
||||||
.wait = msm_pipe_wait,
|
.wait = msm_pipe_wait,
|
||||||
.destroy = msm_pipe_destroy,
|
.destroy = msm_pipe_destroy,
|
||||||
};
|
};
|
||||||
|
@ -190,6 +217,7 @@ static const struct fd_pipe_funcs legacy_funcs = {
|
||||||
.ringbuffer_new_object = msm_ringbuffer_new_object,
|
.ringbuffer_new_object = msm_ringbuffer_new_object,
|
||||||
.submit_new = msm_submit_new,
|
.submit_new = msm_submit_new,
|
||||||
.get_param = msm_pipe_get_param,
|
.get_param = msm_pipe_get_param,
|
||||||
|
.set_param = msm_pipe_set_param,
|
||||||
.wait = msm_pipe_wait,
|
.wait = msm_pipe_wait,
|
||||||
.destroy = msm_pipe_destroy,
|
.destroy = msm_pipe_destroy,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue