Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/9] drm/i915/de: Convert intel_de_{read,write}() into vfuncs
Date: Fri, 06 Nov 2026 16:50:19 +0200	[thread overview]
Message-ID: <f51fb847cb0bbe5d17eaba71d16fb03059444626@intel.com> (raw)
In-Reply-To: <20261104221842.18799-3-ville.syrjala@linux.intel.com>

On Thu, 05 Nov 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Different platforms will need to do different things in
> their mmio accessors. The plan is to trade the overhead
> of runtime platform checks into no runtime checks and
> the cost of a vfunc call. This seems to provide slightly
> better overall performance.

What's the plan for the 8- and 16-bit counterparts?

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_de.c         | 17 +++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_de.h         |  9 +++++++--
>  .../gpu/drm/i915/display/intel_display_core.h   |  2 ++
>  3 files changed, 26 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_de.c b/drivers/gpu/drm/i915/display/intel_de.c
> index 6b3d06147e58..4f423a684ec2 100644
> --- a/drivers/gpu/drm/i915/display/intel_de.c
> +++ b/drivers/gpu/drm/i915/display/intel_de.c
> @@ -163,7 +163,24 @@ u16 intel_de_read16(struct intel_display *display, intel_reg_t reg)
>  	return intel_uncore_read16(__to_uncore(display), reg);
>  }
>  
> +static u32 i9xx_mmio_read(struct intel_display *display, intel_reg_t reg)
> +{
> +	return intel_uncore_read(__to_uncore(display), reg);
> +}
> +
> +static void i9xx_mmio_write(struct intel_display *display, intel_reg_t reg, u32 val)
> +{
> +	intel_uncore_write(__to_uncore(display), reg, val);
> +}
> +
> +static const struct intel_mmio_funcs i9xx_mmio_funcs = {
> +	.read = i9xx_mmio_read,
> +	.write = i9xx_mmio_write,
> +};
> +
>  void intel_de_init(struct intel_display *display)
>  {
>  	display->mmio.uncore = to_intel_uncore(display->drm);
> +
> +	display->mmio.funcs = &i9xx_mmio_funcs;
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_de.h b/drivers/gpu/drm/i915/display/intel_de.h
> index f1135ee5071b..63aef17e6ed3 100644
> --- a/drivers/gpu/drm/i915/display/intel_de.h
> +++ b/drivers/gpu/drm/i915/display/intel_de.h
> @@ -12,6 +12,11 @@
>  #include "intel_uncore.h"
>  #include "intel_uncore_trace.h"
>  
> +struct intel_mmio_funcs {
> +	u32 (*read)(struct intel_display *display, intel_reg_t reg);
> +	void (*write)(struct intel_display *display, intel_reg_t reg, u32 val);
> +};
> +

Wondering if this should be in intel_display_core.h as all the other
ones are. But let's see how it pans out.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

>  static inline struct intel_uncore *__to_uncore(struct intel_display *display)
>  {
>  	return display->mmio.uncore;
> @@ -30,7 +35,7 @@ intel_de_read(struct intel_display *display, intel_reg_t reg)
>  
>  	intel_dmc_wl_get(display, reg);
>  
> -	val = intel_uncore_read(__to_uncore(display), reg);
> +	val = display->mmio.funcs->read(display, reg);
>  
>  	intel_dmc_wl_put(display, reg);
>  
> @@ -60,7 +65,7 @@ intel_de_write(struct intel_display *display, intel_reg_t reg, u32 val)
>  {
>  	intel_dmc_wl_get(display, reg);
>  
> -	intel_uncore_write(__to_uncore(display), reg, val);
> +	display->mmio.funcs->write(display, reg, val);
>  
>  	intel_dmc_wl_put(display, reg);
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
> index 35409f9abb2f..3a48119f7890 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_core.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_core.h
> @@ -49,6 +49,7 @@ struct intel_fbdev;
>  struct intel_fdi_funcs;
>  struct intel_hotplug_irq_funcs;
>  struct intel_initial_plane_config;
> +struct intel_mmio_funcs;
>  struct intel_opregion;
>  struct intel_overlay;
>  struct intel_uncore;
> @@ -533,6 +534,7 @@ struct intel_display {
>  
>  	struct {
>  		struct intel_uncore *uncore;
> +		const struct intel_mmio_funcs *funcs;
>  	} mmio;
>  
>  	struct {

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-11-06 14:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 22:18 [PATCH 0/9] drm/i915/de: Work towards uncore elimination Ville Syrjala
2026-11-04 22:18 ` [PATCH 1/9] drm/i915/de: Introduce dislay->mmio and intel_de_init() Ville Syrjala
2026-11-04 22:31   ` sashiko-bot
2026-11-05  8:58     ` Jani Nikula
2026-11-05 20:03     ` Ville Syrjälä
2026-11-04 23:29   ` Michał Grzelak
2026-11-04 22:18 ` [PATCH 2/9] drm/i915/de: Convert intel_de_{read,write}() into vfuncs Ville Syrjala
2026-11-06 14:50   ` Jani Nikula [this message]
2026-11-06 15:35     ` Ville Syrjälä
2026-11-04 22:18 ` [PATCH 3/9] drm/i915/de: Introduce mmio read/write templates Ville Syrjala
2026-11-04 23:32   ` Michał Grzelak
2026-11-06 14:52   ` Jani Nikula
2026-11-06 16:03     ` Ville Syrjälä
2026-11-04 22:18 ` [PATCH 4/9] drm/i915/de: Eliminate runtime overhead from DMC wakelock on pre-LNL platforms Ville Syrjala
2026-11-06 14:53   ` Jani Nikula
2026-11-04 22:18 ` [PATCH 5/9] drm/i915/de: Introduce display->mmio.lock Ville Syrjala
2026-11-04 22:35   ` sashiko-bot
2026-11-05  9:32   ` Jani Nikula
2026-11-05 13:43     ` Ville Syrjälä
2026-11-05 13:47       ` Jani Nikula
2026-11-06 14:55   ` Jani Nikula
2026-11-04 22:18 ` [PATCH 6/9] drm/i915/uncore: Don't meddle with mmio debug upon user forcewake Ville Syrjala
2026-11-06 14:58   ` Jani Nikula
2026-11-04 22:18 ` [PATCH 7/9] drm/i915/de: Move unclaimed mmio detection into display code Ville Syrjala
2026-11-04 22:36   ` sashiko-bot
2026-11-06 16:19     ` Ville Syrjälä
2026-11-06 16:39   ` Jani Nikula
2026-11-06 17:24     ` Ville Syrjälä
2026-11-04 22:18 ` [PATCH 8/9] drm/i915/de: Stop using intel_uncore_{read,write}() Ville Syrjala
2026-11-06 15:37   ` Jani Nikula
2026-11-06 15:55     ` Ville Syrjälä
2026-11-04 22:18 ` [PATCH 9/9] drm/xe: Nuke the intel_uncore_{read,write}() wrappers Ville Syrjala
2026-11-06 15:38   ` [PATCH 9/9] drm/xe: Nuke the intel_uncore_{read, write}() wrappers Jani Nikula
2026-11-05  2:14 ` ✓ i915.CI.BAT: success for drm/i915/de: Work towards uncore elimination Patchwork
2026-11-05  4:38 ` ✓ i915.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f51fb847cb0bbe5d17eaba71d16fb03059444626@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox