[Intel-gfx] [PATCH 6/9] drm/i915: Consolidate plane 'prepare' functions

Ander Conselvan de Oliveira conselvan2 at gmail.com
Mon Dec 1 00:29:04 PST 2014


On 11/24/2014 09:53 PM, Matt Roper wrote:
> The 'prepare' step for all types of planes are pretty similar;
> consolidate the three 'prepare' functions into a single function.  This
> paves the way for future integration with the atomic plane handlers.
>
> Note that we pull the 'wait for pending flips' functionality out of the
> primary plane's prepare step and place it directly in the 'setplane'
> code.  When we move to the atomic plane handlers, this code will be in
> the 'atomic begin' step.
>
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
>   drivers/gpu/drm/i915/intel_display.c | 167 +++++++++++++++++++----------------
>   drivers/gpu/drm/i915/intel_drv.h     |   2 +
>   drivers/gpu/drm/i915/intel_sprite.c  |  44 ++-------
>   3 files changed, 99 insertions(+), 114 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 217d1e3..50d4299 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11574,6 +11574,66 @@ disable_unpin:
>   	return 0;
>   }
>
> +/**
> + * intel_prepare_plane_fb - Prepare fb for usage on plane
> + * @plane: drm plane to prepare for
> + * @fb: framebuffer to prepare for presentation
> + *
> + * Prepares a framebuffer for usage on a display plane.  Generally this
> + * involves pinning the underlying object and updating the frontbuffer tracking
> + * bits.  Some older platforms need special physical address handling for
> + * cursor planes.
> + *
> + * Returns 0 on success, negative error code on failure.
> + */
> +int
> +intel_prepare_plane_fb(struct drm_plane *plane,
> +		       struct drm_framebuffer *fb)
> +{
> +	struct drm_device *dev = plane->dev;
> +	struct intel_plane *intel_plane = to_intel_plane(plane);
> +	enum pipe pipe = intel_plane->pipe;
> +	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> +	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);

[...]

> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index fc96d13..5d8c2e0 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1257,41 +1257,6 @@ intel_check_sprite_plane(struct drm_plane *plane,
>   	return 0;
>   }
>
> -static int
> -intel_prepare_sprite_plane(struct drm_plane *plane,
> -			   struct intel_plane_state *state)
> -{
> -	struct drm_device *dev = plane->dev;
> -	struct drm_crtc *crtc = state->base.crtc;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -	struct intel_plane *intel_plane = to_intel_plane(plane);
> -	enum pipe pipe = intel_crtc->pipe;
> -	struct drm_framebuffer *fb = state->base.fb;
> -	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> -	struct drm_i915_gem_object *old_obj = intel_plane->obj;

This used to look at intel_plane->obj, but the new unified prepare 
function uses the value of intel_plane->base.fb, which is not updated in 
intel_commit_sprite_plane().

Ander




More information about the Intel-gfx mailing list