public inbox for intel-xe@lists.freedesktop.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 05/10] drm/i915: Move initial plane vblank wait into display code
Date: Fri, 10 Apr 2026 18:53:58 +0300	[thread overview]
Message-ID: <337f90c770b4a7b7db437ecb1ddfa14787898232@intel.com> (raw)
In-Reply-To: <20260410150449.9699-6-ville.syrjala@linux.intel.com>

On Fri, 10 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The initial plane vblank wait operates on display registers,
> so it really belongs in the display code proper. Move it there.
>
> We can use intel_parent_irq_enabled() to determine if we can
> rely on interrupts or not.
>
> On average we should end up waiting half a frame here, so the
> polling interval can be fairly long. 1 ms (which actually
> makes poll_timeout_us() use ~250-1000 usec) seems good enough
> to me.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yes, it's all nicer this way. Just goes on to show how it's sometimes
better to do things one way to get things rolling, and only afterwards
you understand how it should be done.

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

> ---
>  .../drm/i915/display/intel_initial_plane.c    | 22 ++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_initial_plane.c     |  6 -----
>  drivers/gpu/drm/xe/display/xe_initial_plane.c | 19 ----------------
>  include/drm/intel/display_parent_interface.h  |  2 --
>  4 files changed, 21 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_initial_plane.c b/drivers/gpu/drm/i915/display/intel_initial_plane.c
> index 911d67dceba9..74e10d34c63c 100644
> --- a/drivers/gpu/drm/i915/display/intel_initial_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_initial_plane.c
> @@ -1,14 +1,20 @@
>  // SPDX-License-Identifier: MIT
>  /* Copyright © 2025 Intel Corporation */
>  
> +#include <linux/iopoll.h>
> +
>  #include <drm/drm_print.h>
>  #include <drm/intel/display_parent_interface.h>
>  
> +#include "intel_crtc.h"
> +#include "intel_de.h"
>  #include "intel_display_core.h"
> +#include "intel_display_regs.h"
>  #include "intel_display_types.h"
>  #include "intel_fb.h"
>  #include "intel_frontbuffer.h"
>  #include "intel_initial_plane.h"
> +#include "intel_parent.h"
>  #include "intel_plane.h"
>  
>  struct intel_initial_plane_configs {
> @@ -18,8 +24,22 @@ struct intel_initial_plane_configs {
>  void intel_initial_plane_vblank_wait(struct intel_crtc *crtc)
>  {
>  	struct intel_display *display = to_intel_display(crtc);
> +	u32 start_ts, end_ts;
> +	int ret;
>  
> -	display->parent->initial_plane->vblank_wait(&crtc->base);
> +	/* xe doesn't have interrupts enabled this early */
> +	if (intel_parent_irq_enabled(display)) {
> +		intel_crtc_wait_for_next_vblank(crtc);
> +		return;
> +	}
> +
> +	start_ts = intel_de_read(display, PIPE_FRMTMSTMP(crtc->pipe));
> +
> +	ret = poll_timeout_us(end_ts = intel_de_read(display, PIPE_FRMTMSTMP(crtc->pipe)),
> +			      end_ts != start_ts, 1000, 40 * 1000, false);
> +	if (ret)
> +		drm_warn(display->drm, "[CRTC:%d:%s] early vblank wait timed out\n",
> +			 crtc->base.base.id, crtc->base.name);
>  }
>  
>  static const struct intel_plane_state *
> diff --git a/drivers/gpu/drm/i915/i915_initial_plane.c b/drivers/gpu/drm/i915/i915_initial_plane.c
> index 5cb1adde67b6..7775e657271b 100644
> --- a/drivers/gpu/drm/i915/i915_initial_plane.c
> +++ b/drivers/gpu/drm/i915/i915_initial_plane.c
> @@ -16,11 +16,6 @@
>  #include "i915_drv.h"
>  #include "i915_initial_plane.h"
>  
> -static void i915_initial_plane_vblank_wait(struct drm_crtc *crtc)
> -{
> -	intel_crtc_wait_for_next_vblank(to_intel_crtc(crtc));
> -}
> -
>  static enum intel_memory_type
>  initial_plane_memory_type(struct drm_i915_private *i915)
>  {
> @@ -282,7 +277,6 @@ static void i915_plane_config_fini(struct intel_initial_plane_config *plane_conf
>  }
>  
>  const struct intel_display_initial_plane_interface i915_display_initial_plane_interface = {
> -	.vblank_wait = i915_initial_plane_vblank_wait,
>  	.alloc_obj = i915_alloc_initial_plane_obj,
>  	.setup = i915_initial_plane_setup,
>  	.config_fini = i915_plane_config_fini,
> diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
> index 8f2d0244c03f..37bd15d12169 100644
> --- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
> +++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
> @@ -7,8 +7,6 @@
>  
>  #include "regs/xe_gtt_defs.h"
>  
> -#include "intel_crtc.h"
> -#include "intel_display_regs.h"
>  #include "intel_display_types.h"
>  #include "intel_fb.h"
>  #include "intel_fb_pin.h"
> @@ -19,22 +17,6 @@
>  #include "xe_mmio.h"
>  #include "xe_vram_types.h"
>  
> -/* Early xe has no irq */
> -static void xe_initial_plane_vblank_wait(struct drm_crtc *_crtc)
> -{
> -	struct intel_crtc *crtc = to_intel_crtc(_crtc);
> -	struct xe_device *xe = to_xe_device(crtc->base.dev);
> -	struct xe_reg pipe_frmtmstmp = XE_REG(i915_mmio_reg_offset(PIPE_FRMTMSTMP(crtc->pipe)));
> -	u32 timestamp;
> -	int ret;
> -
> -	timestamp = xe_mmio_read32(xe_root_tile_mmio(xe), pipe_frmtmstmp);
> -
> -	ret = xe_mmio_wait32_not(xe_root_tile_mmio(xe), pipe_frmtmstmp, ~0U, timestamp, 40000U, &timestamp, false);
> -	if (ret < 0)
> -		drm_warn(&xe->drm, "waiting for early vblank failed with %i\n", ret);
> -}
> -
>  static struct xe_bo *
>  initial_plane_bo(struct xe_device *xe,
>  		 struct intel_initial_plane_config *plane_config)
> @@ -172,7 +154,6 @@ static void xe_plane_config_fini(struct intel_initial_plane_config *plane_config
>  }
>  
>  const struct intel_display_initial_plane_interface xe_display_initial_plane_interface = {
> -	.vblank_wait = xe_initial_plane_vblank_wait,
>  	.alloc_obj = xe_alloc_initial_plane_obj,
>  	.setup = xe_initial_plane_setup,
>  	.config_fini = xe_plane_config_fini,
> diff --git a/include/drm/intel/display_parent_interface.h b/include/drm/intel/display_parent_interface.h
> index 9041897c772e..b513e3f9924d 100644
> --- a/include/drm/intel/display_parent_interface.h
> +++ b/include/drm/intel/display_parent_interface.h
> @@ -8,7 +8,6 @@
>  
>  enum vlv_iosf_sb_unit;
>  struct dma_fence;
> -struct drm_crtc;
>  struct drm_device;
>  struct drm_file;
>  struct drm_framebuffer;
> @@ -87,7 +86,6 @@ struct intel_display_hdcp_interface {
>  };
>  
>  struct intel_display_initial_plane_interface {
> -	void (*vblank_wait)(struct drm_crtc *crtc);
>  	struct drm_gem_object *(*alloc_obj)(struct drm_device *drm, struct intel_initial_plane_config *plane_config);
>  	int (*setup)(struct drm_plane_state *plane_state, struct intel_initial_plane_config *plane_config,
>  		     struct drm_framebuffer *fb, struct i915_vma *vma);

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-04-10 15:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 15:04 [PATCH 00/10] drm/i915: Some fixes/cleanups to the BIOS FB stuff Ville Syrjala
2026-04-10 15:04 ` [PATCH 01/10] drm/i915: Introduce sanity to the plane_config pointer vs. array thing Ville Syrjala
2026-04-10 15:40   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 02/10] drm/i915: Remove 'mem' and 'phy_base' from struct intel_initial_plane_config Ville Syrjala
2026-04-10 15:43   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 03/10] drm/i915: Don't pass the whole plane_config to initial_plane_phys() Ville Syrjala
2026-04-10 15:45   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 04/10] drm/i915: Make plane_config->fb a struct drm_framebuffer* Ville Syrjala
2026-04-10 15:48   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 05/10] drm/i915: Move initial plane vblank wait into display code Ville Syrjala
2026-04-10 15:53   ` Jani Nikula [this message]
2026-04-10 15:04 ` [PATCH 06/10] drm/i915: Use a 1 second timeout for the polling vblank wait Ville Syrjala
2026-04-10 15:54   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 07/10] drm/i915: Reject tile4 BIOS FB Ville Syrjala
2026-04-10 15:55   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 08/10] drm/i915: Reject X/Y tiled BIOS FB if we don't have fenced regions Ville Syrjala
2026-04-10 15:56   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 09/10] drm/i915: Completely reject DPT BIOS FBs Ville Syrjala
2026-04-10 16:00   ` Jani Nikula
2026-04-10 15:04 ` [PATCH 10/10] drm/i915: Reject BIOS FB rotation in common code Ville Syrjala
2026-04-10 16:01   ` Jani Nikula
2026-04-10 15:12 ` ✓ CI.KUnit: success for drm/i915: Some fixes/cleanups to the BIOS FB stuff Patchwork
2026-04-10 16:41 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-11  3:46 ` ✓ Xe.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=337f90c770b4a7b7db437ecb1ddfa14787898232@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