Quoting Lionel Landwerlin (2018-03-31 02:04:26) > On 19/03/18 18:16, Tvrtko Ursulin wrote: > > From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > > > As well as exposing active requests on engines via PMU, we can also export > > the current raw values (as tracked by i915 command submission) via a > > dedicated query. > > > > This is to satisfy customers who have userspace load balancing solutions > > implemented on top of their custom kernel patches. > > > > Userspace is now able to include DRM_I915_QUERY_ENGINE_QUEUES in their > > query list, pointing to initialized struct drm_i915_query_engine_queues > > entry. Fields describing engine class and instance userspace would like to > > know about need to be filled in, and i915 will fill in the rest. > > > > Multiple engines can be queried in one go by having multiple queries in > > the query list. > > > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > Cc: Dmitry Rogozhkin <dmitry.v.rogozhkin@xxxxxxxxx> > > --- > > drivers/gpu/drm/i915/i915_query.c | 43 +++++++++++++++++++++++++++++++++++++++ > > include/uapi/drm/i915_drm.h | 26 +++++++++++++++++++++++ > > 2 files changed, 69 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c > > index 3ace929dd90f..b3bc69e8deb7 100644 > > --- a/drivers/gpu/drm/i915/i915_query.c > > +++ b/drivers/gpu/drm/i915/i915_query.c > > @@ -82,9 +82,52 @@ static int query_topology_info(struct drm_i915_private *dev_priv, > > return total_length; > > } > > > > +static int > > +query_engine_queues(struct drm_i915_private *i915, > > + struct drm_i915_query_item *query_item) > > +{ > > + struct drm_i915_query_engine_queues __user *query_ptr = > > + u64_to_user_ptr(query_item->data_ptr); > > + struct drm_i915_query_engine_queues query; > > + struct intel_engine_cs *engine; > > + const int len = sizeof(query); > > + unsigned int i; > > + > > + if (query_item->flags) > > + return -EINVAL; > > + > > + if (!query_item->length) > > + return len; > > + else if (query_item->length < len) > > + return -ENOSPC; > > topology returns EINVAL in that case. I think ENOSPC makes more sense, > do we need to change topology? I suggest -EINVAL, we are still doing user parameter checking. I think we will find more useful cases for -ENOSPC later and so would prefer to keep it clear. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx