freedreno/drm: Quiet pointer to u64 conversion warning
[mesa.git] / src / freedreno / drm / msm_pipe.c
index 13defc6d9178078bbc82c4237d79c8b4501a241a..e42d3b9af65deec68b40bd1799ec5fca2a3a11c3 100644 (file)
@@ -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 = VOID2U64(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;
@@ -168,16 +194,6 @@ static uint64_t get_param(struct fd_pipe *pipe, uint32_t param)
        return value;
 }
 
-static bool use_softpin(void)
-{
-       static int sp = -1;
-       if (sp < 0) {
-               const char *str = getenv("FD_MESA_DEBUG");
-               sp = str && strstr(str, "softpin");
-       }
-       return sp;
-}
-
 struct fd_pipe * msm_pipe_new(struct fd_device *dev,
                enum fd_pipe_id id, uint32_t prio)
 {
@@ -196,9 +212,7 @@ struct fd_pipe * msm_pipe_new(struct fd_device *dev,
 
        pipe = &msm_pipe->base;
 
-       // TODO once kernel changes are in place, this switch will be
-       // based on kernel version:
-       if (use_softpin()) {
+       if (fd_device_version(dev) >= FD_VERSION_SOFTPIN) {
                pipe->funcs = &sp_funcs;
        } else {
                pipe->funcs = &legacy_funcs;