All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Dave Airlie <airlied@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, jani.nikula@intel.com,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [Intel-gfx] [PATCH 2/4] drm/i915/display: move fbdev pin code into fb_pin
Date: Tue, 19 Oct 2021 12:15:13 +0300	[thread overview]
Message-ID: <YW6MoRm2bpAJUwCi@intel.com> (raw)
In-Reply-To: <20211017234106.2412994-3-airlied@gmail.com>

On Mon, Oct 18, 2021 at 09:41:04AM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This moves the fbdev pin code over and moves the internal
> interfaces to static.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fb_pin.c | 37 +++++++++++++++++++--
>  drivers/gpu/drm/i915/display/intel_fb_pin.h | 15 ++++-----
>  drivers/gpu/drm/i915/display/intel_fbdev.c  | 32 ------------------
>  3 files changed, 41 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> index 3f77f3013584..0beb0aa33337 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> @@ -71,7 +71,7 @@ intel_pin_fb_obj_dpt(struct drm_framebuffer *fb,
>  	return vma;
>  }
>  
> -struct i915_vma *
> +static struct i915_vma *
>  intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
>  			   bool phys_cursor,
>  			   const struct i915_ggtt_view *view,
> @@ -199,7 +199,8 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
>  	return vma;
>  }
>  
> -void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags)
> +static void
> +intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags)
>  {
>  	if (flags & PLANE_HAS_FENCE)
>  		i915_vma_unpin_fence(vma);
> @@ -272,3 +273,35 @@ void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state)
>  			intel_dpt_unpin(intel_fb->dpt_vm);
>  	}
>  }
> +
> +void intel_fbdev_unpin(struct intel_fbdev *ifbdev)
> +{
> +	if (ifbdev->vma)
> +		intel_unpin_fb_vma(ifbdev->vma, ifbdev->vma_flags);
> +	ifbdev->vma = NULL;
> +	ifbdev->vma_flags = 0;
> +}
> +
> +int intel_fbdev_pin_and_fence(struct drm_i915_private *dev_priv,
> +			      struct intel_fbdev *ifbdev,
> +			      void **vaddr)
> +{
> +	const struct i915_ggtt_view view = {
> +		.type = I915_GGTT_VIEW_NORMAL,
> +	};
> +	ifbdev->vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, false,
> +						 &view, false, &ifbdev->vma_flags);
> +
> +	if (IS_ERR(ifbdev->vma)) {
> +		return PTR_ERR(ifbdev->vma);
> +	}

I suppose easiest to just regenrate this one after fixing the
sparse/checkpatch issues in the previous patch.

Also the fbdev code still has to root around inside the vma/etc.
so the abstraction is pretty weak. So not sure how much this
buys us.

But I guess no real harm in it either.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +
> +	*vaddr = i915_vma_pin_iomap(ifbdev->vma);
> +	if (IS_ERR(*vaddr)) {
> +		intel_fbdev_unpin(ifbdev);
> +		drm_err(&dev_priv->drm,
> +			"Failed to remap framebuffer into virtual memory\n");
> +		return PTR_ERR(vaddr);
> +	}
> +	return 0;
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.h b/drivers/gpu/drm/i915/display/intel_fb_pin.h
> index e4fcd0218d9d..88d736264348 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb_pin.h
> +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.h
> @@ -8,21 +8,18 @@
>  
>  #include <linux/types.h>
>  
> +struct drm_i915_private;
>  struct drm_framebuffer;
> +struct intel_fbdev;
>  struct i915_vma;
>  struct intel_plane_state;
>  struct i915_ggtt_view;
>  
> -struct i915_vma *
> -intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
> -			   bool phys_cursor,
> -			   const struct i915_ggtt_view *view,
> -			   bool uses_fence,
> -			   unsigned long *out_flags);
> -
> -void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags);
> -
>  int intel_plane_pin_fb(struct intel_plane_state *plane_state);
>  void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state);
>  
> +int intel_fbdev_pin_and_fence(struct drm_i915_private *dev_priv,
> +			      struct intel_fbdev *ifbdev,
> +			      void **vaddr);
> +void intel_fbdev_unpin(struct intel_fbdev *ifbdev);
>  #endif
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index c3ea9639a4ed..cee85fcc2085 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -171,38 +171,6 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
>  	return 0;
>  }
>  
> -static void intel_fbdev_unpin(struct intel_fbdev *ifbdev)
> -{
> -	if (ifbdev->vma)
> -		intel_unpin_fb_vma(ifbdev->vma, ifbdev->vma_flags);
> -	ifbdev->vma = NULL;
> -	ifbdev->vma_flags = 0;
> -}
> -
> -static int intel_fbdev_pin_and_fence(struct drm_i915_private *dev_priv,
> -				     struct intel_fbdev *ifbdev,
> -				     void **vaddr)
> -{
> -	const struct i915_ggtt_view view = {
> -		.type = I915_GGTT_VIEW_NORMAL,
> -	};
> -	ifbdev->vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, false,
> -						 &view, false, &ifbdev->vma_flags);
> -
> -	if (IS_ERR(ifbdev->vma)) {
> -		return PTR_ERR(ifbdev->vma);
> -	}
> -
> -	*vaddr = i915_vma_pin_iomap(ifbdev->vma);
> -	if (IS_ERR(*vaddr)) {
> -		intel_fbdev_unpin(ifbdev);
> -		drm_err(&dev_priv->drm,
> -			"Failed to remap framebuffer into virtual memory\n");
> -		return PTR_ERR(vaddr);
> -	}
> -	return 0;
> -}
> -
>  static int intelfb_create(struct drm_fb_helper *helper,
>  			  struct drm_fb_helper_surface_size *sizes)
>  {
> -- 
> 2.25.4

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2021-10-19  9:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-17 23:41 [Intel-gfx] [PATCH 0/4] finish/rebase fbdev pin refactor Dave Airlie
2021-10-17 23:41 ` [Intel-gfx] [PATCH 1/4] drm/i915/display: refactor fbdev pin/unpin out into functions Dave Airlie
2021-10-19  8:34   ` Ville Syrjälä
2021-10-17 23:41 ` [Intel-gfx] [PATCH 2/4] drm/i915/display: move fbdev pin code into fb_pin Dave Airlie
2021-10-19  9:15   ` Ville Syrjälä [this message]
2021-10-17 23:41 ` [Intel-gfx] [PATCH 3/4] drm/i915/display: drop unused parameter to dpt pin Dave Airlie
2021-10-19  8:14   ` Ville Syrjälä
2021-10-17 23:41 ` [Intel-gfx] [PATCH 4/4] drm/i915/display: drop some unused includes Dave Airlie
2021-10-19  8:24   ` Ville Syrjälä
2021-10-18  0:00 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for finish/rebase fbdev pin refactor Patchwork
2021-10-18  0:01 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-10-18  0:32 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-10-18  1:56 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=YW6MoRm2bpAJUwCi@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.