Re: [PATCH v2 7/7] drm: mxsfb: Factor out mxsfb_update_buffer()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, dem 11.03.2022 um 18:06 +0100 schrieb Marek Vasut:
> Pull functionality responsible for programming framebuffer address into
> the controller into dedicated function mxsfb_update_buffer(). This is a
> clean up. No functional change.
> 
> Signed-off-by: Marek Vasut <marex@xxxxxxx>
> Cc: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
> Cc: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Cc: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> Cc: Peng Fan <peng.fan@xxxxxxx>
> Cc: Robby Cai <robby.cai@xxxxxxx>
> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: Stefan Agner <stefan@xxxxxxxx>

Reviewed-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>

> ---
> V2: No change
> ---
>  drivers/gpu/drm/mxsfb/mxsfb_kms.c | 28 ++++++++++++++++++----------
>  1 file changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> index 497603964add8..4baa3db1f3d10 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> @@ -58,6 +58,22 @@ static dma_addr_t mxsfb_get_fb_paddr(struct drm_plane *plane)
>  	return gem->paddr;
>  }
>  
> +static void
> +mxsfb_update_buffer(struct mxsfb_drm_private *mxsfb, struct drm_plane *plane,
> +		    bool both)
> +{
> +	dma_addr_t paddr;
> +
> +	paddr = mxsfb_get_fb_paddr(plane);
> +	if (!paddr)
> +		return;
> +
> +	if (both)
> +		writel(paddr, mxsfb->base + mxsfb->devdata->cur_buf);
> +
> +	writel(paddr, mxsfb->base + mxsfb->devdata->next_buf);
> +}
> +
>  /*
>   * Setup the MXSFB registers for decoding the pixels out of the framebuffer and
>   * outputting them on the bus.
> @@ -352,7 +368,6 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
>  	struct drm_bridge_state *bridge_state;
>  	struct drm_device *drm = mxsfb->drm;
>  	u32 bus_format = 0;
> -	dma_addr_t paddr;
>  
>  	/* If there is a bridge attached to the LCDIF, use its bus format */
>  	if (mxsfb->bridge) {
> @@ -387,11 +402,7 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
>  	mxsfb_crtc_mode_set_nofb(mxsfb, bus_format);
>  
>  	/* Write cur_buf as well to avoid an initial corrupt frame */
> -	paddr = mxsfb_get_fb_paddr(crtc->primary);
> -	if (paddr) {
> -		writel(paddr, mxsfb->base + mxsfb->devdata->cur_buf);
> -		writel(paddr, mxsfb->base + mxsfb->devdata->next_buf);
> -	}
> +	mxsfb_update_buffer(mxsfb, crtc->primary, true);
>  
>  	mxsfb_enable_controller(mxsfb);
>  
> @@ -491,11 +502,8 @@ static void mxsfb_plane_primary_atomic_update(struct drm_plane *plane,
>  					      struct drm_atomic_state *state)
>  {
>  	struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(plane->dev);
> -	dma_addr_t paddr;
>  
> -	paddr = mxsfb_get_fb_paddr(plane);
> -	if (paddr)
> -		writel(paddr, mxsfb->base + mxsfb->devdata->next_buf);
> +	mxsfb_update_buffer(mxsfb, plane, false);
>  }
>  
>  static void mxsfb_plane_overlay_atomic_update(struct drm_plane *plane,





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux