diff mbox series

[v2,1/6] drm/i915: Add the FIRST_CCS() helper

Message ID 20250326234005.1574688-2-andi.shyti@linux.intel.com (mailing list archive)
State New
Headers show
Series Remove I915_ENGINE_FIRST_RENDER_COMPUTE | expand

Commit Message

Andi Shyti March 26, 2025, 11:40 p.m. UTC
From: Andi Shyti <andi.shyti@intel.com>

Some GPUs, like DG2, can host more than one CCS engine. Some
workarounds or enablements need to happen only once for all the
engines in the GT—for example, on the engine with the lowest
instance.

The FIRST_CCS() helper first checks if the engine is a Compute
engine, and then whether it's the one with the lowest instance.

Signed-off-by: Andi Shyti <andi.shyti@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jani Nikula March 27, 2025, 10:42 a.m. UTC | #1
On Thu, 27 Mar 2025, Andi Shyti <andi.shyti@linux.intel.com> wrote:
> From: Andi Shyti <andi.shyti@intel.com>
>
> Some GPUs, like DG2, can host more than one CCS engine. Some
> workarounds or enablements need to happen only once for all the
> engines in the GT—for example, on the engine with the lowest
> instance.
>
> The FIRST_CCS() helper first checks if the engine is a Compute
> engine, and then whether it's the one with the lowest instance.
>
> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 54538b6f85df..5cb501393c4b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -619,6 +619,9 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
>  #define CCS_MASK(gt) \
>  	ENGINE_INSTANCES_MASK(gt, CCS0, I915_MAX_CCS)
>  
> +#define FIRST_CCS(e__) \
> +	(CCS_MASK(e__->gt) && (__ffs(CCS_MASK(e__->gt)) == e__->instance))
> +

Could I persuade you to find a more specific header file for this, along
with the CCS_MASK etc.?

BR,
Jani.


>  #define HAS_MEDIA_RATIO_MODE(i915) (INTEL_INFO(i915)->has_media_ratio_mode)
>  
>  /*
Andi Shyti March 27, 2025, 11:05 a.m. UTC | #2
On Thu, Mar 27, 2025 at 12:42:50PM +0200, Jani Nikula wrote:
> On Thu, 27 Mar 2025, Andi Shyti <andi.shyti@linux.intel.com> wrote:
> > From: Andi Shyti <andi.shyti@intel.com>
> >
> > Some GPUs, like DG2, can host more than one CCS engine. Some
> > workarounds or enablements need to happen only once for all the
> > engines in the GT—for example, on the engine with the lowest
> > instance.
> >
> > The FIRST_CCS() helper first checks if the engine is a Compute
> > engine, and then whether it's the one with the lowest instance.
> >
> > Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 54538b6f85df..5cb501393c4b 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -619,6 +619,9 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
> >  #define CCS_MASK(gt) \
> >  	ENGINE_INSTANCES_MASK(gt, CCS0, I915_MAX_CCS)
> >  
> > +#define FIRST_CCS(e__) \
> > +	(CCS_MASK(e__->gt) && (__ffs(CCS_MASK(e__->gt)) == e__->instance))
> > +
> 
> Could I persuade you to find a more specific header file for this, along
> with the CCS_MASK etc.?

yes, sure, I think this should go inside the gt/ (I don't also
like the name FIRST_CCS but could not come out with anything
better).

All the engine related defines should go inside the gt/, I will
take care of it, but that's argument for another patch.

Thanks, Jani,
Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 54538b6f85df..5cb501393c4b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -619,6 +619,9 @@  IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define CCS_MASK(gt) \
 	ENGINE_INSTANCES_MASK(gt, CCS0, I915_MAX_CCS)
 
+#define FIRST_CCS(e__) \
+	(CCS_MASK(e__->gt) && (__ffs(CCS_MASK(e__->gt)) == e__->instance))
+
 #define HAS_MEDIA_RATIO_MODE(i915) (INTEL_INFO(i915)->has_media_ratio_mode)
 
 /*