summaryrefslogtreecommitdiffstats
path: root/src/freedreno/drm
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2019-04-16 10:10:05 -0700
committerRob Clark <[email protected]>2019-04-25 14:13:07 -0700
commit650391868935ce047b7108f1c4f25f97323f8031 (patch)
treea67a6399d8a6ace40f683bde7e9e5242ee587ab4 /src/freedreno/drm
parent77d091d0c5dc1f1b174668cb1da5f00ad391d76d (diff)
freedreno/drm: update for robustness
Update UABI header and add FD_PP_PGTABLE and FD_NR_FAULTS params. Robustness can be supported by a kernel which provides the new ABI if it also indicates that per-process pagetables are in use. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/freedreno/drm')
-rw-r--r--src/freedreno/drm/freedreno_drmif.h4
-rw-r--r--src/freedreno/drm/msm_drm.h14
-rw-r--r--src/freedreno/drm/msm_pipe.c26
3 files changed, 44 insertions, 0 deletions
diff --git a/src/freedreno/drm/freedreno_drmif.h b/src/freedreno/drm/freedreno_drmif.h
index a53c3406950..e181da302b3 100644
--- a/src/freedreno/drm/freedreno_drmif.h
+++ b/src/freedreno/drm/freedreno_drmif.h
@@ -52,6 +52,9 @@ enum fd_param_id {
FD_MAX_FREQ,
FD_TIMESTAMP,
FD_NR_RINGS, /* # of rings == # of distinct priority levels */
+ FD_PP_PGTABLE, /* are per-process pagetables used for the pipe/ctx */
+ FD_CTX_FAULTS, /* # of per context faults */
+ FD_GLOBAL_FAULTS, /* # of global (all context) faults */
};
/* bo flags: */
@@ -88,6 +91,7 @@ enum fd_version {
FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */
FD_VERSION_BO_IOVA = 3, /* supports fd_bo_get/put_iova() */
FD_VERSION_SOFTPIN = 4, /* adds softpin, bo name, and dump flag */
+ FD_VERSION_ROBUSTNESS = 5, /* adds FD_NR_FAULTS and FD_PP_PGTABLE */
};
enum fd_version fd_device_version(struct fd_device *dev);
diff --git a/src/freedreno/drm/msm_drm.h b/src/freedreno/drm/msm_drm.h
index 6623a61093a..0baa2bfdd63 100644
--- a/src/freedreno/drm/msm_drm.h
+++ b/src/freedreno/drm/msm_drm.h
@@ -74,6 +74,8 @@ struct drm_msm_timespec {
#define MSM_PARAM_TIMESTAMP 0x05
#define MSM_PARAM_GMEM_BASE 0x06
#define MSM_PARAM_NR_RINGS 0x07
+#define MSM_PARAM_PP_PGTABLE 0x08 /* => 1 for per-process pagetables, else 0 */
+#define MSM_PARAM_FAULTS 0x09
struct drm_msm_param {
__u32 pipe; /* in, MSM_PIPE_x */
@@ -286,6 +288,16 @@ struct drm_msm_submitqueue {
__u32 id; /* out, identifier */
};
+#define MSM_SUBMITQUEUE_PARAM_FAULTS 0
+
+struct drm_msm_submitqueue_query {
+ __u64 data;
+ __u32 id;
+ __u32 param;
+ __u32 len;
+ __u32 pad;
+};
+
#define DRM_MSM_GET_PARAM 0x00
/* placeholder:
#define DRM_MSM_SET_PARAM 0x01
@@ -302,6 +314,7 @@ struct drm_msm_submitqueue {
*/
#define DRM_MSM_SUBMITQUEUE_NEW 0x0A
#define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B
+#define DRM_MSM_SUBMITQUEUE_QUERY 0x0C
#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
#define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new)
@@ -313,6 +326,7 @@ struct drm_msm_submitqueue {
#define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise)
#define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue)
#define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32)
+#define DRM_IOCTL_MSM_SUBMITQUEUE_QUERY DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_QUERY, struct drm_msm_submitqueue_query)
#if defined(__cplusplus)
}
diff --git a/src/freedreno/drm/msm_pipe.c b/src/freedreno/drm/msm_pipe.c
index 7d5b9fcd76f..faad1f6d35d 100644
--- a/src/freedreno/drm/msm_pipe.c
+++ b/src/freedreno/drm/msm_pipe.c
@@ -48,6 +48,26 @@ static int query_param(struct fd_pipe *pipe, uint32_t param,
return 0;
}
+static int query_queue_param(struct fd_pipe *pipe, uint32_t param,
+ uint64_t *value)
+{
+ struct msm_pipe *msm_pipe = to_msm_pipe(pipe);
+ struct drm_msm_submitqueue_query req = {
+ .data = value,
+ .id = msm_pipe->queue_id,
+ .param = param,
+ .len = sizeof(*value),
+ };
+ int ret;
+
+ ret = drmCommandWriteRead(pipe->dev->fd, DRM_MSM_SUBMITQUEUE_QUERY,
+ &req, sizeof(req));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static int msm_pipe_get_param(struct fd_pipe *pipe,
enum fd_param_id param, uint64_t *value)
{
@@ -69,6 +89,12 @@ static int msm_pipe_get_param(struct fd_pipe *pipe,
return query_param(pipe, MSM_PARAM_TIMESTAMP, value);
case FD_NR_RINGS:
return query_param(pipe, MSM_PARAM_NR_RINGS, value);
+ case FD_PP_PGTABLE:
+ return query_param(pipe, MSM_PARAM_PP_PGTABLE, value);
+ case FD_CTX_FAULTS:
+ return query_queue_param(pipe, MSM_SUBMITQUEUE_PARAM_FAULTS, value);
+ case FD_GLOBAL_FAULTS:
+ return query_param(pipe, MSM_PARAM_FAULTS, value);
default:
ERROR_MSG("invalid param id: %d", param);
return -1;