diff mbox

[09/37] drm/arm: Add local 'fb' variables

Message ID 1479498793-31021-10-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Nov. 18, 2016, 7:52 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a local 'fb' variable to a few places to get rid of the
'crtc->primary->fb' stuff. Looks neater and helps me with my ppor
coccinelle skills later.

In some places the local variable was already there, just not used
consistently.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/arm/hdlcd_crtc.c    | 18 ++++++++++--------
 drivers/gpu/drm/arm/malidp_planes.c |  6 +++---
 2 files changed, 13 insertions(+), 11 deletions(-)

Comments

Brian Starkey Nov. 18, 2016, 8:30 p.m. UTC | #1
Hi Ville,

On Fri, Nov 18, 2016 at 09:52:45PM +0200, Ville Syrjälä wrote:
>From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
>Add a local 'fb' variable to a few places to get rid of the
>'crtc->primary->fb' stuff. Looks neater and helps me with my ppor
>coccinelle skills later.
>
>In some places the local variable was already there, just not used
>consistently.

lgtm,

Reviewed-by: Brian Starkey <brian.starkey@arm.com>

>
>Cc: Liviu Dudau <liviu.dudau@arm.com>
>Cc: Brian Starkey <brian.starkey@arm.com>
>Cc: Mali DP Maintainers <malidp@foss.arm.com>
>Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>---
> drivers/gpu/drm/arm/hdlcd_crtc.c    | 18 ++++++++++--------
> drivers/gpu/drm/arm/malidp_planes.c |  6 +++---
> 2 files changed, 13 insertions(+), 11 deletions(-)
>
>diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
>index bbaa55add2d2..8a0fee03aa39 100644
>--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
>+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
>@@ -60,11 +60,12 @@ static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
> {
> 	unsigned int btpp;
> 	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
>+	const struct drm_framebuffer *fb = crtc->primary->state->fb;
> 	uint32_t pixel_format;
> 	struct simplefb_format *format = NULL;
> 	int i;
>
>-	pixel_format = crtc->primary->state->fb->pixel_format;
>+	pixel_format = fb->pixel_format;
>
> 	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
> 		if (supported_formats[i].fourcc == pixel_format)
>@@ -221,27 +222,28 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
> static void hdlcd_plane_atomic_update(struct drm_plane *plane,
> 				      struct drm_plane_state *state)
> {
>+	struct drm_framebuffer *fb = plane->state->fb;
> 	struct hdlcd_drm_private *hdlcd;
> 	struct drm_gem_cma_object *gem;
> 	u32 src_w, src_h, dest_w, dest_h;
> 	dma_addr_t scanout_start;
>
>-	if (!plane->state->fb)
>+	if (!fb)
> 		return;
>
> 	src_w = plane->state->src_w >> 16;
> 	src_h = plane->state->src_h >> 16;
> 	dest_w = plane->state->crtc_w;
> 	dest_h = plane->state->crtc_h;
>-	gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
>-	scanout_start = gem->paddr + plane->state->fb->offsets[0] +
>-		plane->state->crtc_y * plane->state->fb->pitches[0] +
>+	gem = drm_fb_cma_get_gem_obj(fb, 0);
>+	scanout_start = gem->paddr + fb->offsets[0] +
>+		plane->state->crtc_y * fb->pitches[0] +
> 		plane->state->crtc_x *
>-		drm_format_plane_cpp(plane->state->fb->pixel_format, 0);
>+		drm_format_plane_cpp(fb->pixel_format, 0);
>
> 	hdlcd = plane->dev->dev_private;
>-	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
>-	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
>+	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
>+	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]);
> 	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
> 	hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
> }
>diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
>index 63eec8f37cfc..ee7f7663a307 100644
>--- a/drivers/gpu/drm/arm/malidp_planes.c
>+++ b/drivers/gpu/drm/arm/malidp_planes.c
>@@ -137,8 +137,8 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>
> 	/* packed RGB888 / BGR888 can't be rotated or flipped */
> 	if (state->rotation != DRM_ROTATE_0 &&
>-	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
>-	     state->fb->pixel_format == DRM_FORMAT_BGR888))
>+	    (fb->pixel_format == DRM_FORMAT_RGB888 ||
>+	     fb->pixel_format == DRM_FORMAT_BGR888))
> 		return -EINVAL;
>
> 	ms->rotmem_size = 0;
>@@ -147,7 +147,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>
> 		val = mp->hwdev->rotmem_required(mp->hwdev, state->crtc_h,
> 						 state->crtc_w,
>-						 state->fb->pixel_format);
>+						 fb->pixel_format);
> 		if (val < 0)
> 			return val;
>
>-- 
>2.7.4
>
Liviu Dudau Nov. 21, 2016, 11:51 a.m. UTC | #2
On Fri, Nov 18, 2016 at 09:52:45PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a local 'fb' variable to a few places to get rid of the
> 'crtc->primary->fb' stuff. Looks neater and helps me with my ppor
> coccinelle skills later.
> 
> In some places the local variable was already there, just not used
> consistently.
> 
> Cc: Liviu Dudau <liviu.dudau@arm.com>

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Are you going to take the series through drm-misc or you want each sub-maintainer
to cherry pick the patches?

Best regards,
Liviu

> Cc: Brian Starkey <brian.starkey@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/arm/hdlcd_crtc.c    | 18 ++++++++++--------
>  drivers/gpu/drm/arm/malidp_planes.c |  6 +++---
>  2 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
> index bbaa55add2d2..8a0fee03aa39 100644
> --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> @@ -60,11 +60,12 @@ static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
>  {
>  	unsigned int btpp;
>  	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
> +	const struct drm_framebuffer *fb = crtc->primary->state->fb;
>  	uint32_t pixel_format;
>  	struct simplefb_format *format = NULL;
>  	int i;
>  
> -	pixel_format = crtc->primary->state->fb->pixel_format;
> +	pixel_format = fb->pixel_format;
>  
>  	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
>  		if (supported_formats[i].fourcc == pixel_format)
> @@ -221,27 +222,28 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
>  static void hdlcd_plane_atomic_update(struct drm_plane *plane,
>  				      struct drm_plane_state *state)
>  {
> +	struct drm_framebuffer *fb = plane->state->fb;
>  	struct hdlcd_drm_private *hdlcd;
>  	struct drm_gem_cma_object *gem;
>  	u32 src_w, src_h, dest_w, dest_h;
>  	dma_addr_t scanout_start;
>  
> -	if (!plane->state->fb)
> +	if (!fb)
>  		return;
>  
>  	src_w = plane->state->src_w >> 16;
>  	src_h = plane->state->src_h >> 16;
>  	dest_w = plane->state->crtc_w;
>  	dest_h = plane->state->crtc_h;
> -	gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
> -	scanout_start = gem->paddr + plane->state->fb->offsets[0] +
> -		plane->state->crtc_y * plane->state->fb->pitches[0] +
> +	gem = drm_fb_cma_get_gem_obj(fb, 0);
> +	scanout_start = gem->paddr + fb->offsets[0] +
> +		plane->state->crtc_y * fb->pitches[0] +
>  		plane->state->crtc_x *
> -		drm_format_plane_cpp(plane->state->fb->pixel_format, 0);
> +		drm_format_plane_cpp(fb->pixel_format, 0);
>  
>  	hdlcd = plane->dev->dev_private;
> -	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
> -	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
> +	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
> +	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]);
>  	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
>  	hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
>  }
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 63eec8f37cfc..ee7f7663a307 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -137,8 +137,8 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>  
>  	/* packed RGB888 / BGR888 can't be rotated or flipped */
>  	if (state->rotation != DRM_ROTATE_0 &&
> -	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
> -	     state->fb->pixel_format == DRM_FORMAT_BGR888))
> +	    (fb->pixel_format == DRM_FORMAT_RGB888 ||
> +	     fb->pixel_format == DRM_FORMAT_BGR888))
>  		return -EINVAL;
>  
>  	ms->rotmem_size = 0;
> @@ -147,7 +147,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>  
>  		val = mp->hwdev->rotmem_required(mp->hwdev, state->crtc_h,
>  						 state->crtc_w,
> -						 state->fb->pixel_format);
> +						 fb->pixel_format);
>  		if (val < 0)
>  			return val;
>  
> -- 
> 2.7.4
>
Ville Syrjälä Nov. 22, 2016, 1:48 p.m. UTC | #3
On Mon, Nov 21, 2016 at 11:51:21AM +0000, Liviu Dudau wrote:
> On Fri, Nov 18, 2016 at 09:52:45PM +0200, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Add a local 'fb' variable to a few places to get rid of the
> > 'crtc->primary->fb' stuff. Looks neater and helps me with my ppor
> > coccinelle skills later.
> > 
> > In some places the local variable was already there, just not used
> > consistently.
> > 
> > Cc: Liviu Dudau <liviu.dudau@arm.com>
> 
> Acked-by: Liviu Dudau <liviu.dudau@arm.com>
> 
> Are you going to take the series through drm-misc or you want each sub-maintainer
> to cherry pick the patches?

Probably easier to suck it all in one go. Unless drm-misc maintainers
disagree?

> 
> Best regards,
> Liviu
> 
> > Cc: Brian Starkey <brian.starkey@arm.com>
> > Cc: Mali DP Maintainers <malidp@foss.arm.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/arm/hdlcd_crtc.c    | 18 ++++++++++--------
> >  drivers/gpu/drm/arm/malidp_planes.c |  6 +++---
> >  2 files changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
> > index bbaa55add2d2..8a0fee03aa39 100644
> > --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> > +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> > @@ -60,11 +60,12 @@ static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
> >  {
> >  	unsigned int btpp;
> >  	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
> > +	const struct drm_framebuffer *fb = crtc->primary->state->fb;
> >  	uint32_t pixel_format;
> >  	struct simplefb_format *format = NULL;
> >  	int i;
> >  
> > -	pixel_format = crtc->primary->state->fb->pixel_format;
> > +	pixel_format = fb->pixel_format;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
> >  		if (supported_formats[i].fourcc == pixel_format)
> > @@ -221,27 +222,28 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
> >  static void hdlcd_plane_atomic_update(struct drm_plane *plane,
> >  				      struct drm_plane_state *state)
> >  {
> > +	struct drm_framebuffer *fb = plane->state->fb;
> >  	struct hdlcd_drm_private *hdlcd;
> >  	struct drm_gem_cma_object *gem;
> >  	u32 src_w, src_h, dest_w, dest_h;
> >  	dma_addr_t scanout_start;
> >  
> > -	if (!plane->state->fb)
> > +	if (!fb)
> >  		return;
> >  
> >  	src_w = plane->state->src_w >> 16;
> >  	src_h = plane->state->src_h >> 16;
> >  	dest_w = plane->state->crtc_w;
> >  	dest_h = plane->state->crtc_h;
> > -	gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
> > -	scanout_start = gem->paddr + plane->state->fb->offsets[0] +
> > -		plane->state->crtc_y * plane->state->fb->pitches[0] +
> > +	gem = drm_fb_cma_get_gem_obj(fb, 0);
> > +	scanout_start = gem->paddr + fb->offsets[0] +
> > +		plane->state->crtc_y * fb->pitches[0] +
> >  		plane->state->crtc_x *
> > -		drm_format_plane_cpp(plane->state->fb->pixel_format, 0);
> > +		drm_format_plane_cpp(fb->pixel_format, 0);
> >  
> >  	hdlcd = plane->dev->dev_private;
> > -	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
> > -	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
> > +	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
> > +	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]);
> >  	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
> >  	hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
> >  }
> > diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> > index 63eec8f37cfc..ee7f7663a307 100644
> > --- a/drivers/gpu/drm/arm/malidp_planes.c
> > +++ b/drivers/gpu/drm/arm/malidp_planes.c
> > @@ -137,8 +137,8 @@ static int malidp_de_plane_check(struct drm_plane *plane,
> >  
> >  	/* packed RGB888 / BGR888 can't be rotated or flipped */
> >  	if (state->rotation != DRM_ROTATE_0 &&
> > -	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
> > -	     state->fb->pixel_format == DRM_FORMAT_BGR888))
> > +	    (fb->pixel_format == DRM_FORMAT_RGB888 ||
> > +	     fb->pixel_format == DRM_FORMAT_BGR888))
> >  		return -EINVAL;
> >  
> >  	ms->rotmem_size = 0;
> > @@ -147,7 +147,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
> >  
> >  		val = mp->hwdev->rotmem_required(mp->hwdev, state->crtc_h,
> >  						 state->crtc_w,
> > -						 state->fb->pixel_format);
> > +						 fb->pixel_format);
> >  		if (val < 0)
> >  			return val;
> >  
> > -- 
> > 2.7.4
> > 
> 
> -- 
> ====================
> | I would like to |
> | fix the world,  |
> | but they're not |
> | giving me the   |
>  \ source code!  /
>   ---------------
>     ¯\_(ツ)_/¯
Daniel Vetter Nov. 22, 2016, 1:57 p.m. UTC | #4
On Tue, Nov 22, 2016 at 03:48:50PM +0200, Ville Syrjälä wrote:
> On Mon, Nov 21, 2016 at 11:51:21AM +0000, Liviu Dudau wrote:
> > On Fri, Nov 18, 2016 at 09:52:45PM +0200, ville.syrjala@linux.intel.com wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Add a local 'fb' variable to a few places to get rid of the
> > > 'crtc->primary->fb' stuff. Looks neater and helps me with my ppor
> > > coccinelle skills later.
> > > 
> > > In some places the local variable was already there, just not used
> > > consistently.
> > > 
> > > Cc: Liviu Dudau <liviu.dudau@arm.com>
> > 
> > Acked-by: Liviu Dudau <liviu.dudau@arm.com>
> > 
> > Are you going to take the series through drm-misc or you want each sub-maintainer
> > to cherry pick the patches?
> 
> Probably easier to suck it all in one go. Unless drm-misc maintainers
> disagree?

Seems like exactly the thing drm-misc is for.
-Daniel

> 
> > 
> > Best regards,
> > Liviu
> > 
> > > Cc: Brian Starkey <brian.starkey@arm.com>
> > > Cc: Mali DP Maintainers <malidp@foss.arm.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/arm/hdlcd_crtc.c    | 18 ++++++++++--------
> > >  drivers/gpu/drm/arm/malidp_planes.c |  6 +++---
> > >  2 files changed, 13 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
> > > index bbaa55add2d2..8a0fee03aa39 100644
> > > --- a/drivers/gpu/drm/arm/hdlcd_crtc.c
> > > +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
> > > @@ -60,11 +60,12 @@ static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
> > >  {
> > >  	unsigned int btpp;
> > >  	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
> > > +	const struct drm_framebuffer *fb = crtc->primary->state->fb;
> > >  	uint32_t pixel_format;
> > >  	struct simplefb_format *format = NULL;
> > >  	int i;
> > >  
> > > -	pixel_format = crtc->primary->state->fb->pixel_format;
> > > +	pixel_format = fb->pixel_format;
> > >  
> > >  	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
> > >  		if (supported_formats[i].fourcc == pixel_format)
> > > @@ -221,27 +222,28 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
> > >  static void hdlcd_plane_atomic_update(struct drm_plane *plane,
> > >  				      struct drm_plane_state *state)
> > >  {
> > > +	struct drm_framebuffer *fb = plane->state->fb;
> > >  	struct hdlcd_drm_private *hdlcd;
> > >  	struct drm_gem_cma_object *gem;
> > >  	u32 src_w, src_h, dest_w, dest_h;
> > >  	dma_addr_t scanout_start;
> > >  
> > > -	if (!plane->state->fb)
> > > +	if (!fb)
> > >  		return;
> > >  
> > >  	src_w = plane->state->src_w >> 16;
> > >  	src_h = plane->state->src_h >> 16;
> > >  	dest_w = plane->state->crtc_w;
> > >  	dest_h = plane->state->crtc_h;
> > > -	gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
> > > -	scanout_start = gem->paddr + plane->state->fb->offsets[0] +
> > > -		plane->state->crtc_y * plane->state->fb->pitches[0] +
> > > +	gem = drm_fb_cma_get_gem_obj(fb, 0);
> > > +	scanout_start = gem->paddr + fb->offsets[0] +
> > > +		plane->state->crtc_y * fb->pitches[0] +
> > >  		plane->state->crtc_x *
> > > -		drm_format_plane_cpp(plane->state->fb->pixel_format, 0);
> > > +		drm_format_plane_cpp(fb->pixel_format, 0);
> > >  
> > >  	hdlcd = plane->dev->dev_private;
> > > -	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
> > > -	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
> > > +	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
> > > +	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]);
> > >  	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
> > >  	hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
> > >  }
> > > diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> > > index 63eec8f37cfc..ee7f7663a307 100644
> > > --- a/drivers/gpu/drm/arm/malidp_planes.c
> > > +++ b/drivers/gpu/drm/arm/malidp_planes.c
> > > @@ -137,8 +137,8 @@ static int malidp_de_plane_check(struct drm_plane *plane,
> > >  
> > >  	/* packed RGB888 / BGR888 can't be rotated or flipped */
> > >  	if (state->rotation != DRM_ROTATE_0 &&
> > > -	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
> > > -	     state->fb->pixel_format == DRM_FORMAT_BGR888))
> > > +	    (fb->pixel_format == DRM_FORMAT_RGB888 ||
> > > +	     fb->pixel_format == DRM_FORMAT_BGR888))
> > >  		return -EINVAL;
> > >  
> > >  	ms->rotmem_size = 0;
> > > @@ -147,7 +147,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
> > >  
> > >  		val = mp->hwdev->rotmem_required(mp->hwdev, state->crtc_h,
> > >  						 state->crtc_w,
> > > -						 state->fb->pixel_format);
> > > +						 fb->pixel_format);
> > >  		if (val < 0)
> > >  			return val;
> > >  
> > > -- 
> > > 2.7.4
> > > 
> > 
> > -- 
> > ====================
> > | I would like to |
> > | fix the world,  |
> > | but they're not |
> > | giving me the   |
> >  \ source code!  /
> >   ---------------
> >     ¯\_(ツ)_/¯
> 
> -- 
> Ville Syrjälä
> Intel OTC
diff mbox

Patch

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index bbaa55add2d2..8a0fee03aa39 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -60,11 +60,12 @@  static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
 {
 	unsigned int btpp;
 	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
+	const struct drm_framebuffer *fb = crtc->primary->state->fb;
 	uint32_t pixel_format;
 	struct simplefb_format *format = NULL;
 	int i;
 
-	pixel_format = crtc->primary->state->fb->pixel_format;
+	pixel_format = fb->pixel_format;
 
 	for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
 		if (supported_formats[i].fourcc == pixel_format)
@@ -221,27 +222,28 @@  static int hdlcd_plane_atomic_check(struct drm_plane *plane,
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
 				      struct drm_plane_state *state)
 {
+	struct drm_framebuffer *fb = plane->state->fb;
 	struct hdlcd_drm_private *hdlcd;
 	struct drm_gem_cma_object *gem;
 	u32 src_w, src_h, dest_w, dest_h;
 	dma_addr_t scanout_start;
 
-	if (!plane->state->fb)
+	if (!fb)
 		return;
 
 	src_w = plane->state->src_w >> 16;
 	src_h = plane->state->src_h >> 16;
 	dest_w = plane->state->crtc_w;
 	dest_h = plane->state->crtc_h;
-	gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
-	scanout_start = gem->paddr + plane->state->fb->offsets[0] +
-		plane->state->crtc_y * plane->state->fb->pitches[0] +
+	gem = drm_fb_cma_get_gem_obj(fb, 0);
+	scanout_start = gem->paddr + fb->offsets[0] +
+		plane->state->crtc_y * fb->pitches[0] +
 		plane->state->crtc_x *
-		drm_format_plane_cpp(plane->state->fb->pixel_format, 0);
+		drm_format_plane_cpp(fb->pixel_format, 0);
 
 	hdlcd = plane->dev->dev_private;
-	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
-	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
+	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
+	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, fb->pitches[0]);
 	hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
 	hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
 }
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 63eec8f37cfc..ee7f7663a307 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -137,8 +137,8 @@  static int malidp_de_plane_check(struct drm_plane *plane,
 
 	/* packed RGB888 / BGR888 can't be rotated or flipped */
 	if (state->rotation != DRM_ROTATE_0 &&
-	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
-	     state->fb->pixel_format == DRM_FORMAT_BGR888))
+	    (fb->pixel_format == DRM_FORMAT_RGB888 ||
+	     fb->pixel_format == DRM_FORMAT_BGR888))
 		return -EINVAL;
 
 	ms->rotmem_size = 0;
@@ -147,7 +147,7 @@  static int malidp_de_plane_check(struct drm_plane *plane,
 
 		val = mp->hwdev->rotmem_required(mp->hwdev, state->crtc_h,
 						 state->crtc_w,
-						 state->fb->pixel_format);
+						 fb->pixel_format);
 		if (val < 0)
 			return val;