intel/perf: specify sseu configuration when supported
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 2 Mar 2020 12:43:30 +0000 (14:43 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Apr 2020 15:55:59 +0000 (15:55 +0000)
Because of functional requirements for Gen11, when perf is enabled we
only power half the EU array.

This change forces it to enable everything.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4021>

src/intel/perf/gen_perf.c
src/intel/perf/gen_perf_private.h
src/intel/perf/gen_perf_query.c

index 43e14a2accb42531ec796e4feff058aef5849a7e..189f71f6575f5f370ea9009ebbe9b68e3e5f309e 100644 (file)
 
 #define OA_REPORT_INVALID_CTX_ID (0xffffffff)
 
-static inline uint64_t to_user_pointer(void *ptr)
-{
-   return (uintptr_t) ptr;
-}
-
 static bool
 is_dir_or_link(const struct dirent *entry, const char *parent_dir)
 {
index 3dc3461cbf31c0685c9083d99555228de21e7e68..ac222d5372703a99b7dc0f2ed308e78aa1dfa5b4 100644 (file)
 
 #include "gen_perf.h"
 
+static inline uint64_t to_user_pointer(void *ptr)
+{
+   return (uintptr_t) ptr;
+}
+
 static inline void
 gen_perf_query_add_stat_reg(struct gen_perf_query_info *query, uint32_t reg,
                             uint32_t numerator, uint32_t denominator,
index 3ad511b0e0083895172665337039a687b1474cc2..57b01203a6f0cfb8fe67df8eb403660b49bae557 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "perf/gen_perf.h"
 #include "perf/gen_perf_mdapi.h"
+#include "perf/gen_perf_private.h"
 #include "perf/gen_perf_query.h"
 #include "perf/gen_perf_regs.h"
 
@@ -347,6 +348,8 @@ gen_perf_close(struct gen_perf_context *perfquery,
    }
 }
 
+#define NUM_PERF_PROPERTIES(array) (ARRAY_SIZE(array) / 2)
+
 static bool
 gen_perf_open(struct gen_perf_context *perf_ctx,
               int metrics_set_id,
@@ -366,12 +369,17 @@ gen_perf_open(struct gen_perf_context *perf_ctx,
       DRM_I915_PERF_PROP_OA_METRICS_SET, metrics_set_id,
       DRM_I915_PERF_PROP_OA_FORMAT, report_format,
       DRM_I915_PERF_PROP_OA_EXPONENT, period_exponent,
+
+      /* SSEU configuration */
+      DRM_I915_PERF_PROP_GLOBAL_SSEU, to_user_pointer(&perf_ctx->perf->sseu),
    };
    struct drm_i915_perf_open_param param = {
       .flags = I915_PERF_FLAG_FD_CLOEXEC |
                I915_PERF_FLAG_FD_NONBLOCK |
                I915_PERF_FLAG_DISABLED,
-      .num_properties = ARRAY_SIZE(properties) / 2,
+      .num_properties = perf_ctx->perf->i915_perf_version >= 4 ?
+                        NUM_PERF_PROPERTIES(properties) :
+                        NUM_PERF_PROPERTIES(properties) - 1,
       .properties_ptr = (uintptr_t) properties,
    };
    int fd = gen_ioctl(drm_fd, DRM_IOCTL_I915_PERF_OPEN, &param);