Re: [PATCH 06/37] drm/gma500: Add some local 'fb' variables

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

 



On Fri, Nov 18, 2016 at 09:52:42PM +0200, ville.syrjala@xxxxxxxxxxxxxxx wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> 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 poor
> coccinelle skills later.
> 
> Cc: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/gma500/gma_display.c         | 13 +++++++------
>  drivers/gpu/drm/gma500/mdfld_intel_display.c | 15 ++++++++-------
>  drivers/gpu/drm/gma500/oaktrail_crtc.c       | 13 +++++++------
>  3 files changed, 22 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
> index 1a1cf7a3b5ef..05b9a4ceb58d 100644
> --- a/drivers/gpu/drm/gma500/gma_display.c
> +++ b/drivers/gpu/drm/gma500/gma_display.c
> @@ -59,7 +59,8 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_psb_private *dev_priv = dev->dev_private;
>  	struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
> -	struct psb_framebuffer *psbfb = to_psb_fb(crtc->primary->fb);
> +	struct drm_framebuffer *fb = crtc->primary->fb;
> +	struct psb_framebuffer *psbfb = to_psb_fb(fb);
>  	int pipe = gma_crtc->pipe;
>  	const struct psb_offset *map = &dev_priv->regmap[pipe];
>  	unsigned long start, offset;
> @@ -70,7 +71,7 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  		return 0;
>  
>  	/* no fb bound */
> -	if (!crtc->primary->fb) {
> +	if (!fb) {
>  		dev_err(dev->dev, "No FB bound\n");
>  		goto gma_pipe_cleaner;
>  	}
> @@ -81,19 +82,19 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  	if (ret < 0)
>  		goto gma_pipe_set_base_exit;
>  	start = psbfb->gtt->offset;
> -	offset = y * crtc->primary->fb->pitches[0] + x * (crtc->primary->fb->bits_per_pixel / 8);
> +	offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
>  
> -	REG_WRITE(map->stride, crtc->primary->fb->pitches[0]);
> +	REG_WRITE(map->stride, fb->pitches[0]);
>  
>  	dspcntr = REG_READ(map->cntr);
>  	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
>  
> -	switch (crtc->primary->fb->bits_per_pixel) {
> +	switch (fb->bits_per_pixel) {
>  	case 8:
>  		dspcntr |= DISPPLANE_8BPP;
>  		break;
>  	case 16:
> -		if (crtc->primary->fb->depth == 15)
> +		if (fb->depth == 15)
>  			dspcntr |= DISPPLANE_15_16BPP;
>  		else
>  			dspcntr |= DISPPLANE_16BPP;
> diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c
> index 92e3f93ee682..e80895285e94 100644
> --- a/drivers/gpu/drm/gma500/mdfld_intel_display.c
> +++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c
> @@ -165,8 +165,9 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  {
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_psb_private *dev_priv = dev->dev_private;
> +	struct drm_framebuffer *fb = crtc->primary->fb;
>  	struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
> -	struct psb_framebuffer *psbfb = to_psb_fb(crtc->primary->fb);
> +	struct psb_framebuffer *psbfb = to_psb_fb(fb);
>  	int pipe = gma_crtc->pipe;
>  	const struct psb_offset *map = &dev_priv->regmap[pipe];
>  	unsigned long start, offset;
> @@ -178,12 +179,12 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  	dev_dbg(dev->dev, "pipe = 0x%x.\n", pipe);
>  
>  	/* no fb bound */
> -	if (!crtc->primary->fb) {
> +	if (!fb) {
>  		dev_dbg(dev->dev, "No FB bound\n");
>  		return 0;
>  	}
>  
> -	ret = check_fb(crtc->primary->fb);
> +	ret = check_fb(fb);
>  	if (ret)
>  		return ret;
>  
> @@ -196,18 +197,18 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
>  		return 0;
>  
>  	start = psbfb->gtt->offset;
> -	offset = y * crtc->primary->fb->pitches[0] + x * (crtc->primary->fb->bits_per_pixel / 8);
> +	offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
>  
> -	REG_WRITE(map->stride, crtc->primary->fb->pitches[0]);
> +	REG_WRITE(map->stride, fb->pitches[0]);
>  	dspcntr = REG_READ(map->cntr);
>  	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
>  
> -	switch (crtc->primary->fb->bits_per_pixel) {
> +	switch (fb->bits_per_pixel) {
>  	case 8:
>  		dspcntr |= DISPPLANE_8BPP;
>  		break;
>  	case 16:
> -		if (crtc->primary->fb->depth == 15)
> +		if (fb->depth == 15)
>  			dspcntr |= DISPPLANE_15_16BPP;
>  		else
>  			dspcntr |= DISPPLANE_16BPP;
> diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c
> index da9fd34b9550..a51896544d91 100644
> --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c
> +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c
> @@ -599,7 +599,8 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_psb_private *dev_priv = dev->dev_private;
>  	struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
> -	struct psb_framebuffer *psbfb = to_psb_fb(crtc->primary->fb);
> +	struct drm_framebuffer *fb = crtc->primary->fb;
> +	struct psb_framebuffer *psbfb = to_psb_fb(fb);
>  	int pipe = gma_crtc->pipe;
>  	const struct psb_offset *map = &dev_priv->regmap[pipe];
>  	unsigned long start, offset;
> @@ -608,7 +609,7 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
>  	int ret = 0;
>  
>  	/* no fb bound */
> -	if (!crtc->primary->fb) {
> +	if (!fb) {
>  		dev_dbg(dev->dev, "No FB bound\n");
>  		return 0;
>  	}
> @@ -617,19 +618,19 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
>  		return 0;
>  
>  	start = psbfb->gtt->offset;
> -	offset = y * crtc->primary->fb->pitches[0] + x * (crtc->primary->fb->bits_per_pixel / 8);
> +	offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
>  
> -	REG_WRITE(map->stride, crtc->primary->fb->pitches[0]);
> +	REG_WRITE(map->stride, fb->pitches[0]);
>  
>  	dspcntr = REG_READ(map->cntr);
>  	dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
>  
> -	switch (crtc->primary->fb->bits_per_pixel) {
> +	switch (fb->bits_per_pixel) {
>  	case 8:
>  		dspcntr |= DISPPLANE_8BPP;
>  		break;
>  	case 16:
> -		if (crtc->primary->fb->depth == 15)
> +		if (fb->depth == 15)
>  			dspcntr |= DISPPLANE_15_16BPP;
>  		else
>  			dspcntr |= DISPPLANE_16BPP;
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[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