Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
	intel-gvt-dev@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Subject: Re: [PATCH 1/5] drm/i915/display: Abstract pipe/trans/cursor offset calculation
Date: Mon, 15 Dec 2025 13:44:47 +0200	[thread overview]
Message-ID: <9c87d4900c7ab9aeeaaa3336544230e0f4e47cf5@intel.com> (raw)
In-Reply-To: <20251215111842.2099789-2-ankit.k.nautiyal@intel.com>

On Mon, 15 Dec 2025, Ankit Nautiyal <ankit.k.nautiyal@intel.com> wrote:
> Introduce INTEL_DISPLAY_DEVICE_*_OFFSET() macros to compute absolute
> MMIO offsets for pipe, transcoder, and cursor registers.
>
> Update _MMIO_PIPE2/_MMIO_TRANS2/_MMIO_CURSOR2 to use these macros
> for cleaner abstraction and to prepare for external API usage (e.g. GVT).
>
> Also move DISPLAY_MMIO_BASE() to intel_display_device.h so it can be
> abstracted in GVT, allowing register macros to resolve via
> exported helpers rather than peeking into struct intel_display.
>
> Suggested-by: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  .../gpu/drm/i915/display/intel_display_device.h | 17 +++++++++++++++++
>  .../drm/i915/display/intel_display_reg_defs.h   | 15 ++++-----------
>  2 files changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
> index 50b2e9ae2c18..05bba7a9899a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
> @@ -260,6 +260,23 @@ struct intel_display_platforms {
>  	 ((id) == ARLS_HOST_BRIDGE_PCI_ID3) || \
>  	 ((id) == ARLS_HOST_BRIDGE_PCI_ID4))
>  
> +#define INTEL_DISPLAY_DEVICE_PIPE_OFFSET(display, pipe) \
> +	(DISPLAY_INFO(display)->pipe_offsets[(pipe)] - \
> +	 DISPLAY_INFO(display)->pipe_offsets[PIPE_A] + \
> +	 DISPLAY_MMIO_BASE(display))
> +
> +#define INTEL_DISPLAY_DEVICE_TRANS_OFFSET(display, trans) \
> +	(DISPLAY_INFO(display)->trans_offsets[(trans)] - \
> +	 DISPLAY_INFO(display)->trans_offsets[TRANSCODER_A] + \
> +	 DISPLAY_MMIO_BASE(display))
> +
> +#define INTEL_DISPLAY_DEVICE_CURSOR_OFFSET(display, pipe) \
> +	(DISPLAY_INFO(display)->cursor_offsets[(pipe)] - \
> +	 DISPLAY_INFO(display)->cursor_offsets[PIPE_A] + \
> +	 DISPLAY_MMIO_BASE(display))
> +
> +#define DISPLAY_MMIO_BASE(dev_priv)	(DISPLAY_INFO(dev_priv)->mmio_offset)

Please s/dev_priv/display/ while at it.

> +
>  struct intel_display_runtime_info {
>  	struct intel_display_ip_ver {
>  		u16 ver;
> diff --git a/drivers/gpu/drm/i915/display/intel_display_reg_defs.h b/drivers/gpu/drm/i915/display/intel_display_reg_defs.h
> index b83ad06f2ea7..74f572d3a202 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_reg_defs.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_reg_defs.h
> @@ -8,8 +8,6 @@
>  
>  #include "i915_reg_defs.h"
>  
> -#define DISPLAY_MMIO_BASE(dev_priv)	(DISPLAY_INFO(dev_priv)->mmio_offset)
> -
>  #define VLV_DISPLAY_BASE		0x180000
>  
>  /*
> @@ -36,14 +34,9 @@
>   * Device info offset array based helpers for groups of registers with unevenly
>   * spaced base offsets.
>   */
> -#define _MMIO_PIPE2(display, pipe, reg)		_MMIO(DISPLAY_INFO(display)->pipe_offsets[(pipe)] - \
> -						      DISPLAY_INFO(display)->pipe_offsets[PIPE_A] + \
> -						      DISPLAY_MMIO_BASE(display) + (reg))
> -#define _MMIO_TRANS2(display, tran, reg)	_MMIO(DISPLAY_INFO(display)->trans_offsets[(tran)] - \
> -						      DISPLAY_INFO(display)->trans_offsets[TRANSCODER_A] + \
> -						      DISPLAY_MMIO_BASE(display) + (reg))
> -#define _MMIO_CURSOR2(display, pipe, reg)	_MMIO(DISPLAY_INFO(display)->cursor_offsets[(pipe)] - \
> -						      DISPLAY_INFO(display)->cursor_offsets[PIPE_A] + \
> -						      DISPLAY_MMIO_BASE(display) + (reg))
> +
> +#define _MMIO_PIPE2(display, pipe, reg)		_MMIO(INTEL_DISPLAY_DEVICE_PIPE_OFFSET(display, pipe) + (reg))
> +#define _MMIO_TRANS2(display, trans, reg)	_MMIO(INTEL_DISPLAY_DEVICE_TRANS_OFFSET(display, trans) + (reg))
> +#define _MMIO_CURSOR2(display, pipe, reg)	_MMIO(INTEL_DISPLAY_DEVICE_CURSOR_OFFSET(display, pipe) + (reg))

Please wrap the macro argument usage in parenthesis, even if not
strictly needed here. IMO it's just good code hygiene, and sets the
example.

With these fixed,

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


BR,
Jani.

>  
>  #endif /* __INTEL_DISPLAY_REG_DEFS_H__ */

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-12-15 11:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 11:18 [PATCH 0/5] Prepare GVT for display modularization Ankit Nautiyal
2025-12-15 11:18 ` [PATCH 1/5] drm/i915/display: Abstract pipe/trans/cursor offset calculation Ankit Nautiyal
2025-12-15 11:44   ` Jani Nikula [this message]
2025-12-16  9:29     ` Nautiyal, Ankit K
2025-12-15 11:18 ` [PATCH 2/5] drm/i915/display: Add APIs to be used by gvt to get the register offsets Ankit Nautiyal
2025-12-15 11:51   ` Jani Nikula
2025-12-15 11:18 ` [PATCH 3/5] drm/i915/gvt: Add header to use display offset functions in macros Ankit Nautiyal
2025-12-15 11:53   ` Jani Nikula
2025-12-16  9:30     ` Nautiyal, Ankit K
2025-12-15 11:18 ` [PATCH 4/5] drm/i915/gvt: Change for_each_pipe to use pipe_mask API Ankit Nautiyal
2025-12-15 12:00   ` Jani Nikula
2025-12-16  9:31     ` Nautiyal, Ankit K
2025-12-15 11:18 ` [PATCH 5/5] drm/i915/gvt/display_helpers: Cast argument to enum pipe for pipe-offset macro Ankit Nautiyal
2025-12-15 12:03   ` Jani Nikula
2025-12-16  9:27     ` Nautiyal, Ankit K
2025-12-15 15:44 ` ✓ i915.CI.BAT: success for Prepare GVT for display modularization Patchwork
2025-12-15 20:49 ` ✗ i915.CI.Full: failure " 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=9c87d4900c7ab9aeeaaa3336544230e0f4e47cf5@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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