[Libva] [LIBVA_INTEL_DRIVER][PATCH 1/4] Query the kernel API to check the EU counts of GPU device
Xiang, Haihao
haihao.xiang at intel.com
Fri Nov 18 01:33:34 UTC 2016
> On 11/18/2016 08:47 AM, Xiang, Haihao wrote:
> > On Wed, 2016-11-16 at 21:06 -0500, Zhao Yakui wrote:
> > > This info can be used to configure the max EU threads of GPU
> > > device.
> > > > eu_total * 6
> > >
> > > Signed-off-by: Zhao Yakui<yakui.zhao at intel.com>
> > > ---
> > > src/intel_driver.c | 13 +++++++++++++
> > > src/intel_driver.h | 3 +++
> > > 2 files changed, 16 insertions(+)
> > >
> > > diff --git a/src/intel_driver.c b/src/intel_driver.c
> > > index bb19401..a2c8c71 100644
> > > --- a/src/intel_driver.c
> > > +++ b/src/intel_driver.c
> > > @@ -50,6 +50,12 @@ uint32_t g_intel_debug_option_flags = 0;
> > > #define LOCAL_I915_PARAM_HAS_HUC 42
> > > #endif
> > >
> > > +#ifdef I915_PARAM_EU_TOTAL
> > > +#define LOCAL_I915_PARAM_EU_TOTAL I915_PARAM_EU_TOTAL
> > > +#else
> > > +#define LOCAL_I915_PARAM_EU_TOTAL 34
> > > +#endif
> > > +
> > > static Bool
> > > intel_driver_get_param(struct intel_driver_data *intel, int
> > > param,
> > > int *value)
> > > {
> > > @@ -142,6 +148,13 @@ intel_driver_init(VADriverContextP ctx)
> > > if (intel_driver_get_param(intel, LOCAL_I915_PARAM_HAS_HUC,
> > > &ret_value))
> > > intel->has_huc = !!ret_value;
> > >
> > > + intel->has_eu_flag = 0;
> > > + intel->eu_total = 0;
> > > + if (intel_driver_get_param(intel, LOCAL_I915_PARAM_EU_TOTAL,
> > > &ret_value)) {
> > > + intel->has_eu_flag = !!ret_value;
> > > + intel->eu_total = ret_value;
> > > + }
> > > +
> > > intel_driver_get_revid(intel,&intel->revision);
> > > return true;
> > > }
> > > diff --git a/src/intel_driver.h b/src/intel_driver.h
> > > index dcdc03b..a02bfa8 100644
> > > --- a/src/intel_driver.h
> > > +++ b/src/intel_driver.h
> > > @@ -182,6 +182,9 @@ struct intel_driver_data
> > > unsigned int has_vebox : 1; /* Flag: has VEBOX unit */
> > > unsigned int has_bsd2 : 1; /* Flag: has the second BSD
> > > video
> > > ring unit */
> > > unsigned int has_huc : 1; /* Flag: has a fully loaded
> > > HuC
> > > firmware? */
> > > + unsigned int has_eu_flag : 1; /* Flag: Kernel will return EU
> > > counts */
> > > +
> > > + int eu_total;
> >
> >
> > adding eu_total is enough, we can use the following if ... else
> > statement later
>
> In fact the has_eu_flag is equal to the condition check.
> > if (intel->eu_total > 0)
>
> It only use extra bit_field to avoid calling it every time.
however the extra bit is still used every time.
>
> >
> > if (intel->eu_total> 0) {
> > ...
> > } else {
> > ...
> > }
> >
> > It avoids setting the number of thread to 0 (although it is
> > unlikely)
> > as well.
> >
> > >
> > > const struct intel_device_info *device_info;
> > > };
>
More information about the Libva
mailing list