[PATCH 4/9] drm/i915: Extract intel_plane_needs_physical()

Jani Nikula jani.nikula at linux.intel.com
Mon May 6 14:05:54 UTC 2024


On Mon, 06 May 2024, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Pull the "does this plane need a physical address?" check into
> a small helper.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c | 8 ++++++++
>  drivers/gpu/drm/i915/display/intel_atomic_plane.h | 1 +
>  drivers/gpu/drm/i915/display/intel_fb_pin.c       | 9 +++------
>  3 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index b083b985d170..27224ecdc94c 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -144,6 +144,14 @@ intel_plane_destroy_state(struct drm_plane *plane,
>  	kfree(plane_state);
>  }
>  
> +bool intel_plane_needs_physical(struct intel_plane *plane)
> +{
> +	struct drm_i915_private *i915 = to_i915(plane->base.dev);
> +
> +	return plane->id == PLANE_CURSOR &&
> +		DISPLAY_INFO(i915)->cursor_needs_physical;
> +}
> +
>  unsigned int intel_adjusted_rate(const struct drm_rect *src,
>  				 const struct drm_rect *dst,
>  				 unsigned int rate)
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.h b/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> index 191dad0efc8e..e7a0699f17c8 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> @@ -66,5 +66,6 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state);
>  void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
>  			       struct intel_plane_state *plane_state);
>  void intel_plane_helper_add(struct intel_plane *plane);
> +bool intel_plane_needs_physical(struct intel_plane *plane);
>  
>  #endif /* __INTEL_ATOMIC_PLANE_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> index 2b50c1946c63..5b71d9488184 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> @@ -11,6 +11,7 @@
>  #include "gem/i915_gem_object.h"
>  
>  #include "i915_drv.h"
> +#include "intel_atomic_plane.h"
>  #include "intel_display_types.h"
>  #include "intel_dpt.h"
>  #include "intel_fb.h"
> @@ -236,15 +237,11 @@ void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags)
>  int intel_plane_pin_fb(struct intel_plane_state *plane_state)
>  {
>  	struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
> -	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
>  	struct drm_framebuffer *fb = plane_state->hw.fb;
>  	struct i915_vma *vma;
> -	bool phys_cursor =
> -		plane->id == PLANE_CURSOR &&
> -		DISPLAY_INFO(dev_priv)->cursor_needs_physical;
>  
>  	if (!intel_fb_uses_dpt(fb)) {
> -		vma = intel_pin_and_fence_fb_obj(fb, phys_cursor,
> +		vma = intel_pin_and_fence_fb_obj(fb, intel_plane_needs_physical(plane),
>  						 &plane_state->view.gtt,
>  						 intel_plane_uses_fence(plane_state),
>  						 &plane_state->flags);
> @@ -259,7 +256,7 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state)
>  		 * will trigger might_sleep() even if it won't actually sleep,
>  		 * which is the case when the fb has already been pinned.
>  		 */
> -		if (phys_cursor)
> +		if (intel_plane_needs_physical(plane))
>  			plane_state->phys_dma_addr =
>  				i915_gem_object_get_dma_address(intel_fb_obj(fb), 0);
>  	} else {

-- 
Jani Nikula, Intel


More information about the Intel-gfx mailing list