intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 13/15] drm/xe/display: Use async flip for flipping initial fb.
Date: Tue, 1 Oct 2024 16:59:06 +0300	[thread overview]
Message-ID: <ZvwAKivxnl0mUik4@intel.com> (raw)
In-Reply-To: <20240930195749.318998-14-maarten.lankhorst@linux.intel.com>

On Mon, Sep 30, 2024 at 09:57:47PM +0200, Maarten Lankhorst wrote:
> Since memirq requires a ggtt allocation, irqs will be initialised
> later. This means we cannot rely on drm_wait_for_vblank any more as
> it requires interrupts.
> 
> Fortunately there's still SURFLIVE
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/xe/display/xe_plane_initial.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> index 4660db0aecb68..3fd0fe2dbc27a 100644
> --- a/drivers/gpu/drm/xe/display/xe_plane_initial.c
> +++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> @@ -17,6 +17,8 @@
>  #include "intel_fb_pin.h"
>  #include "intel_frontbuffer.h"
>  #include "intel_plane_initial.h"
> +#include "intel_uncore.h"
> +#include "skl_universal_plane_regs.h"
>  #include "xe_bo.h"
>  #include "xe_wa.h"
>  
> @@ -187,6 +189,7 @@ static void
>  intel_find_initial_plane_obj(struct intel_crtc *crtc,
>  			     struct intel_initial_plane_config plane_configs[])
>  {
> +	struct xe_device *xe = to_xe_device(crtc->base.dev);
>  	struct intel_initial_plane_config *plane_config =
>  		&plane_configs[crtc->pipe];
>  	struct intel_plane *plane =
> @@ -235,6 +238,14 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,
>  	plane_state->uapi.crtc = &crtc->base;
>  	intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc);
>  
> +	/* Flip async, we don't have interrupts yet */
> +	plane_state->ctl = intel_uncore_read(&xe->uncore, PLANE_CTL(plane->pipe, PLANE_1));
> +	plane->async_flip(plane, to_intel_crtc_state(crtc->base.state), plane_state, true);
> +
> +	/* Wait 40 ms (1 frame at 25 fps) for async flip to complete */
> +	if (intel_wait_for_register_fw(&xe->uncore, PLANE_SURFLIVE(plane->pipe, PLANE_1), XE_PAGE_SIZE - 1, vma->node->base.start, 40) < 0)
> +		drm_warn(&xe->drm, "async flip timed out\n");

Please wrap that in a function...

> +
>  	atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits);
>  
>  	plane_config->vma = vma;
> @@ -292,9 +303,6 @@ void intel_initial_plane_config(struct drm_i915_private *i915)
>  		 */
>  		intel_find_initial_plane_obj(crtc, plane_configs);
>  
> -		if (i915->display.funcs.display->fixup_initial_plane_config(crtc, plane_config))
> -			intel_crtc_wait_for_next_vblank(crtc);

... and use it here instead of abusing async flips.

But perhaps it would actually be best to suck that vblank wait into
.fixup_plane_config(). That would keep the SURF write and SURFLIVE
read close by at least.

Although it would require some kind of "are interrupts enabled yet?"
check which will need some kind of abstract interface in the end,
but for now I guess for now we could go with a IS_ENABLED() check
since we already have one of those in skl_universal_plane.c.
Hmm, or I guess we could just pass in a parameter to
.fixup_initial_plane_config() indicating what to do, since we
currently call this from driver specific code anyway.

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2024-10-01 13:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 19:57 [PATCH v2 00/15] drm/xe: Fix flickering when inheriting BIOS fb Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 01/15] drm/xe/display: Handle stolen bar readout in the same way as lmem Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 02/15] drm/xe: Remove double pageflip Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 03/15] drm/xe: Move suballocator init to after display init Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 04/15] drm/xe: Initialize UC after xe_display_init_noaccel Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 05/15] drm/xe: Use xe_ggtt_map_bo_unlocked for resume Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 06/15] drm/xe: Add xe_ggtt_might_lock Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 07/15] drm/xe: Add xe_ggtt_alloc Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 08/15] drm/xe/display: Abstract read/write functions for GGTT PTEs Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 09/15] drm/xe: Make xe_ggtt_pt_ops private Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 10/15] drm/xe/display: Stop dereferencing ggtt in xe_fb_pin Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 11/15] " Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 12/15] drm/xe: Move struct xe_ggtt to xe_ggtt.c Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 13/15] drm/xe/display: Use async flip for flipping initial fb Maarten Lankhorst
2024-10-01  9:09   ` Jani Nikula
2024-10-01 13:59   ` Ville Syrjälä [this message]
2024-09-30 19:57 ` [PATCH v2 14/15] drm/xe: Move interrupt initialisation until after xe_display_init_noaccel Maarten Lankhorst
2024-09-30 19:57 ` [PATCH v2 15/15] drm/xe: Initialise GGTT later Maarten Lankhorst
2024-10-01  0:05 ` ✓ CI.Patch_applied: success for drm/xe: Fix flickering when inheriting BIOS fb. (rev2) Patchwork
2024-10-01  0:05 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-01  0:06 ` ✓ CI.KUnit: success " Patchwork
2024-10-01  0:18 ` ✓ CI.Build: " Patchwork
2024-10-01  0:20 ` ✗ CI.Hooks: failure " Patchwork
2024-10-01  0:22 ` ✓ CI.checksparse: success " Patchwork
2024-10-01  0:42 ` ✗ CI.BAT: failure " Patchwork
2024-10-01 10:35 ` ✓ CI.FULL: success " 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=ZvwAKivxnl0mUik4@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=maarten.lankhorst@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;
as well as URLs for NNTP newsgroup(s).