[PATCH 32/32] drm: Nuke fb->pixel_format

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Nov 17 18:39:04 UTC 2016


Hi Ville,

Thank you for the patch.

On Thursday 17 Nov 2016 18:14:31 ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Replace uses of fb->bits_per_pixel with fb->format->format.

I assume you mean fb->pixel_format.

> Less duplicated information is a good thing.
> 
> Note that coccinelle failed to eliminate the
> "/* fourcc format */" comment from drm_framebuffer.h, so I had
> to do that part manually.

[snip]

> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c          |  4 +--
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c          |  4 +--
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c           |  4 +--
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c           |  4 +--
>  drivers/gpu/drm/arc/arcpgu_crtc.c               |  2 +-
>  drivers/gpu/drm/arm/hdlcd_crtc.c                |  4 +--
>  drivers/gpu/drm/arm/malidp_planes.c             | 10 +++----
>  drivers/gpu/drm/armada/armada_crtc.c            |  2 +-
>  drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_layer.c |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++-------
>  drivers/gpu/drm/drm_atomic.c                    |  6 ++--
>  drivers/gpu/drm/drm_crtc.c                      |  4 +--
>  drivers/gpu/drm/drm_crtc_helper.c               |  4 +--
>  drivers/gpu/drm/drm_fb_cma_helper.c             |  2 +-
>  drivers/gpu/drm/drm_framebuffer.c               |  2 +-
>  drivers/gpu/drm/drm_modeset_helper.c            |  1 -
>  drivers/gpu/drm/drm_plane.c                     |  6 ++--
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c   |  2 +-
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c      |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c        |  2 +-
>  drivers/gpu/drm/exynos/exynos_mixer.c           |  8 ++---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c     |  4 +--
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c |  6 ++--
>  drivers/gpu/drm/i915/i915_debugfs.c             |  3 +-
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  4 +--
>  drivers/gpu/drm/i915/intel_display.c            | 33 ++++++++++----------
>  drivers/gpu/drm/i915/intel_fbdev.c              |  2 +-
>  drivers/gpu/drm/i915/intel_overlay.c            |  2 +-
>  drivers/gpu/drm/i915/intel_pm.c                 | 10 +++----
>  drivers/gpu/drm/i915/intel_sprite.c             | 12 ++++----
>  drivers/gpu/drm/imx/ipuv3-plane.c               | 40 +++++++++-------------
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c        |  2 +-
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c       |  2 +-
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       |  4 +--
>  drivers/gpu/drm/msm/msm_fb.c                    | 10 +++----
>  drivers/gpu/drm/nouveau/dispnv04/overlay.c      |  8 ++---
>  drivers/gpu/drm/nouveau/nv50_display.c          |  4 +--
>  drivers/gpu/drm/omapdrm/omap_fb.c               | 10 +++----
>  drivers/gpu/drm/radeon/atombios_crtc.c          |  8 ++---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c         |  4 +--
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c           |  4 +--
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c     | 22 +++++++-------
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c       |  6 ++--
>  drivers/gpu/drm/shmobile/shmob_drm_plane.c      |  4 +--
>  drivers/gpu/drm/sti/sti_gdp.c                   | 10 +++----
>  drivers/gpu/drm/sti/sti_hqvdp.c                 |  2 +-
>  drivers/gpu/drm/sun4i/sun4i_backend.c           |  5 ++--
>  drivers/gpu/drm/tegra/dc.c                      |  6 ++--
>  drivers/gpu/drm/tegra/fb.c                      |  2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c            |  4 +--
>  drivers/gpu/drm/tilcdc/tilcdc_plane.c           |  4 +--
>  drivers/gpu/drm/vc4/vc4_plane.c                 |  6 ++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c             |  2 --
>  drivers/gpu/drm/zte/zx_plane.c                  |  2 +-
>  include/drm/drm_framebuffer.h                   |  4 ---
>  56 files changed, 171 insertions(+), 179 deletions(-)

[snip]

> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> b/drivers/gpu/drm/drm_crtc_helper.c index 5d2cb138eba6..94bce0b462aa 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -588,8 +588,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
> if (set->crtc->primary->fb == NULL) {
>  			DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
>  			mode_changed = true;
> -		} else if (set->fb->pixel_format !=
> -			   set->crtc->primary->fb->pixel_format) {
> +		} else if (set->fb->format->format !=
> +			   set->crtc->primary->fb->format->format) {
>  			mode_changed = true;

You could also compare set->fb->format != set->crtc->primary->fb->format which 
should be slightly more efficient.

>  		} else
>  			fb_changed = true;

[snip]

> diff --git a/drivers/gpu/drm/drm_framebuffer.c
> b/drivers/gpu/drm/drm_framebuffer.c index 98c054098808..e48c9e7fa78e 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -634,7 +634,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct
> drm_framebuffer *fb, INIT_LIST_HEAD(&fb->filp_head);
>  	if (WARN_ON_ONCE(fb->dev != dev)) {
>  		fb->dev = dev;
> -		fb->format = drm_format_info(fb->pixel_format);
> +		fb->format = drm_format_info(fb->format->format);

This is an interesting one :-) If fb->format is NULL you will crash, and if it 
isn't this is a no-op.

>  	}
>  	fb->funcs = funcs;

[snip]

> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> b/drivers/gpu/drm/i915/i915_debugfs.c index ee272ec8732c..e571e9a37ac4
> 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3042,7 +3042,8 @@ static void intel_plane_info(struct seq_file *m,
> struct intel_crtc *intel_crtc) state = plane->state;
> 
>  		if (state->fb) {
> -			drm_get_format_name(state->fb->pixel_format, 
&format_name);
> +			drm_get_format_name(state->fb->format->format,
> +					    &format_name);

(randomly picking a driver for this comment)

As a candidate for another patch series, what would you think about storing 
format names in the format info structure, and getting rid of the 
drm_get_format_name() function ? It might increase the kernel size a bit 
though, but I don't think that's an issue.

>  		} else {
>  			sprintf(format_name.str, "N/A");
>  		}

[snip]

> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c index 6c889f0e8e0f..f5f9f1422d69
> 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c

[snip]

> @@ -12151,7 +12148,7 @@ static int intel_crtc_page_flip(struct drm_crtc
> *crtc, return -EBUSY;
> 
>  	/* Can't change pixel format via MI display flips. */
> -	if (fb->pixel_format != crtc->primary->fb->pixel_format)
> +	if (fb->format->format != crtc->primary->fb->format->format)

You can write this

	fb->format != crtc->primary->fb->format

>  		return -EINVAL;

[snip]

> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c
> b/drivers/gpu/drm/imx/ipuv3-plane.c index e74a0ad52950..76fcc5f0d9e1 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -77,7 +77,7 @@ drm_plane_state_to_eba(struct drm_plane_state *state)
>  	BUG_ON(!cma_obj);
> 
>  	return cma_obj->paddr + fb->offsets[0] + fb->pitches[0] * y +
> -	       drm_format_plane_cpp(fb->pixel_format, 0) * x;
> +	       drm_format_plane_cpp(fb->format->format, 0) * x;

You should use fb->format->cpp[0]. Likewise for the other format information 
fields accessed in this driver.

>  }
> 
>  static inline unsigned long
> @@ -92,11 +92,11 @@ drm_plane_state_to_ubo(struct drm_plane_state *state)
>  	cma_obj = drm_fb_cma_get_gem_obj(fb, 1);
>  	BUG_ON(!cma_obj);
> 
> -	x /= drm_format_horz_chroma_subsampling(fb->pixel_format);
> -	y /= drm_format_vert_chroma_subsampling(fb->pixel_format);
> +	x /= drm_format_horz_chroma_subsampling(fb->format->format);
> +	y /= drm_format_vert_chroma_subsampling(fb->format->format);
> 
>  	return cma_obj->paddr + fb->offsets[1] + fb->pitches[1] * y +
> -	       drm_format_plane_cpp(fb->pixel_format, 1) * x - eba;
> +	       drm_format_plane_cpp(fb->format->format, 1) * x - eba;
>  }
> 
>  static inline unsigned long
> @@ -111,11 +111,11 @@ drm_plane_state_to_vbo(struct drm_plane_state *state)
>  	cma_obj = drm_fb_cma_get_gem_obj(fb, 2);
>  	BUG_ON(!cma_obj);
> 
> -	x /= drm_format_horz_chroma_subsampling(fb->pixel_format);
> -	y /= drm_format_vert_chroma_subsampling(fb->pixel_format);
> +	x /= drm_format_horz_chroma_subsampling(fb->format->format);
> +	y /= drm_format_vert_chroma_subsampling(fb->format->format);
> 
>  	return cma_obj->paddr + fb->offsets[2] + fb->pitches[2] * y +
> -	       drm_format_plane_cpp(fb->pixel_format, 2) * x - eba;
> +	       drm_format_plane_cpp(fb->format->format, 2) * x - eba;
>  }
> 
>  void ipu_plane_put_resources(struct ipu_plane *ipu_plane)
> @@ -281,7 +281,7 @@ static int ipu_plane_atomic_check(struct drm_plane
> *plane, */
>  	if (old_fb && (state->src_w != old_state->src_w ||
>  			      state->src_h != old_state->src_h ||
> -			      fb->pixel_format != old_fb->pixel_format))
> +			      fb->format->format != old_fb->format->format))

	fb->format != old_fb->format

Likewise for the other locations in this driver.

[snip]


> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index
> 81c0562ab489..fb32d4563d92 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -340,7 +340,7 @@ static int mdp5_plane_atomic_check(struct drm_plane
> *plane, if (plane_enabled(state) && plane_enabled(old_state)) {
>  		/* we cannot change SMP block configuration during scanout: */
>  		bool full_modeset = false;
> -		if (state->fb->pixel_format != old_state->fb->pixel_format) {
> +		if (state->fb->format->format != old_state->fb->format-
>format) {

Ditto.

>  			DBG("%s: pixel_format change!", mdp5_plane->name);
>  			full_modeset = true;
>  		}
> @@ -703,7 +703,7 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
>  	unsigned long flags;
>  	int ret;
> 
> -	nplanes = drm_format_num_planes(fb->pixel_format);
> +	nplanes = drm_format_num_planes(fb->format->format);

	fb->format->num_planes

> 
>  	/* bad formats should already be rejected: */
>  	if (WARN_ON(nplanes > pipe2nclients(pipe)))
> diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
> index 9614ed405808..5b579248fbaa 100644
> --- a/drivers/gpu/drm/msm/msm_fb.c
> +++ b/drivers/gpu/drm/msm/msm_fb.c
> @@ -41,7 +41,7 @@ static int msm_framebuffer_create_handle(struct
> drm_framebuffer *fb, static void msm_framebuffer_destroy(struct
> drm_framebuffer *fb)
>  {
>  	struct msm_framebuffer *msm_fb = to_msm_framebuffer(fb);
> -	int i, n = drm_format_num_planes(fb->pixel_format);
> +	int i, n = drm_format_num_planes(fb->format->format);

Same here and below.

>  	DBG("destroy: FB ID: %d (%p)", fb->base.id, fb);
> 
> @@ -65,10 +65,10 @@ static const struct drm_framebuffer_funcs
> msm_framebuffer_funcs = { void msm_framebuffer_describe(struct
> drm_framebuffer *fb, struct seq_file *m) {
>  	struct msm_framebuffer *msm_fb = to_msm_framebuffer(fb);
> -	int i, n = drm_format_num_planes(fb->pixel_format);
> +	int i, n = drm_format_num_planes(fb->format->format);
> 
>  	seq_printf(m, "fb: %dx%d@%4.4s (%2d, ID:%d)\n",
> -			fb->width, fb->height, (char *)&fb->pixel_format,
> +			fb->width, fb->height, (char *)&fb->format->format,
>  			drm_framebuffer_read_refcount(fb), fb->base.id);
> 
>  	for (i = 0; i < n; i++) {
> @@ -87,7 +87,7 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb,
> struct seq_file *m) int msm_framebuffer_prepare(struct drm_framebuffer *fb,
> int id)
>  {
>  	struct msm_framebuffer *msm_fb = to_msm_framebuffer(fb);
> -	int ret, i, n = drm_format_num_planes(fb->pixel_format);
> +	int ret, i, n = drm_format_num_planes(fb->format->format);
>  	uint32_t iova;
> 
>  	for (i = 0; i < n; i++) {
> @@ -103,7 +103,7 @@ int msm_framebuffer_prepare(struct drm_framebuffer *fb,
> int id) void msm_framebuffer_cleanup(struct drm_framebuffer *fb, int id)
>  {
>  	struct msm_framebuffer *msm_fb = to_msm_framebuffer(fb);
> -	int i, n = drm_format_num_planes(fb->pixel_format);
> +	int i, n = drm_format_num_planes(fb->format->format);
> 
>  	for (i = 0; i < n; i++)
>  		msm_gem_put_iova(msm_fb->planes[i], id);

[snip]

> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c
> b/drivers/gpu/drm/omapdrm/omap_fb.c index 9875c99be009..d2742772b9d8 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -107,7 +107,7 @@ static int omap_framebuffer_create_handle(struct
> drm_framebuffer *fb, static void omap_framebuffer_destroy(struct
> drm_framebuffer *fb)
>  {
>  	struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb);
> -	int i, n = drm_format_num_planes(fb->pixel_format);
> +	int i, n = drm_format_num_planes(fb->format->format);

	fb->format->num_planes

Same comment for the other locations below.

>  	DBG("destroy: FB ID: %d (%p)", fb->base.id, fb);
> 
> @@ -252,7 +252,7 @@ void omap_framebuffer_update_scanout(struct
> drm_framebuffer *fb, int omap_framebuffer_pin(struct drm_framebuffer *fb)
>  {
>  	struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb);
> -	int ret, i, n = drm_format_num_planes(fb->pixel_format);
> +	int ret, i, n = drm_format_num_planes(fb->format->format);
> 
>  	mutex_lock(&omap_fb->lock);
> 
> @@ -292,7 +292,7 @@ int omap_framebuffer_pin(struct drm_framebuffer *fb)
>  void omap_framebuffer_unpin(struct drm_framebuffer *fb)
>  {
>  	struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb);
> -	int i, n = drm_format_num_planes(fb->pixel_format);
> +	int i, n = drm_format_num_planes(fb->format->format);
> 
>  	mutex_lock(&omap_fb->lock);
> 
> @@ -343,10 +343,10 @@ struct drm_connector
> *omap_framebuffer_get_next_connector( void omap_framebuffer_describe(struct
> drm_framebuffer *fb, struct seq_file *m) {
>  	struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb);
> -	int i, n = drm_format_num_planes(fb->pixel_format);
> +	int i, n = drm_format_num_planes(fb->format->format);
> 
>  	seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height,
> -			(char *)&fb->pixel_format);
> +			(char *)&fb->format->format);
> 
>  	for (i = 0; i < n; i++) {
>  		struct plane *plane = &omap_fb->planes[i];

[snip]

> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index
> c7eba305c488..f8c6f74edc80 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c

[snip]

> @@ -749,21 +749,21 @@ static void vop_plane_atomic_update(struct drm_plane
> *plane, dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
> dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
> 
> -	offset = (src->x1 >> 16) * drm_format_plane_cpp(fb->pixel_format, 0);
> +	offset = (src->x1 >> 16) * drm_format_plane_cpp(fb->format->format, 
0);

fb->format->cpp[0]

Same comment for the other fields accessed below.

>  	offset += (src->y1 >> 16) * fb->pitches[0];
>  	dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];
> 
> -	format = vop_convert_format(fb->pixel_format);
> +	format = vop_convert_format(fb->format->format);
> 
>  	spin_lock(&vop->reg_lock);
> 
>  	VOP_WIN_SET(vop, win, format, format);
>  	VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> 2);
>  	VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
> -	if (is_yuv_support(fb->pixel_format)) {
> -		int hsub = drm_format_horz_chroma_subsampling(fb-
>pixel_format);
> -		int vsub = drm_format_vert_chroma_subsampling(fb-
>pixel_format);
> -		int bpp = drm_format_plane_cpp(fb->pixel_format, 1);
> +	if (is_yuv_support(fb->format->format)) {
> +		int hsub = drm_format_horz_chroma_subsampling(fb->format-
>format);
> +		int vsub = drm_format_vert_chroma_subsampling(fb->format-
>format);
> +		int bpp = drm_format_plane_cpp(fb->format->format, 1);
> 
>  		uv_obj = rockchip_fb_get_gem_obj(fb, 1);
>  		rk_uv_obj = to_rockchip_obj(uv_obj);

[snip]

> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 81df3097b545..33821dda79df 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c

[snip]

> @@ -753,11 +753,11 @@ static void sti_gdp_atomic_update(struct drm_plane
> *drm_plane, cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
> 
>  	DRM_DEBUG_DRIVER("drm FB:%d format:%.4s phys@:0x%lx\n", fb->base.id,
> -			 (char *)&fb->pixel_format,
> +			 (char *)&fb->format->format,
>  			 (unsigned long)cma_obj->paddr);
> 
>  	/* pixel memory location */
> -	bpp = drm_format_plane_cpp(fb->pixel_format, 0);
> +	bpp = drm_format_plane_cpp(fb->format->format, 0);

fb->format->cpp[0]

>  	top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
>  	top_field->gam_gdp_pml += src_x * bpp;
>  	top_field->gam_gdp_pml += src_y * fb->pitches[0];


> diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c
> b/drivers/gpu/drm/sun4i/sun4i_backend.c index 2e08f969bb64..8719acf745c2
> 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_backend.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c

[snip]

> @@ -218,7 +219,7 @@ int sun4i_backend_update_layer_buffer(struct
> sun4i_backend *backend, DRM_DEBUG_DRIVER("Using GEM @ %pad\n",
> &gem->paddr);
> 
>  	/* Compute the start of the displayed memory */
> -	bpp = drm_format_plane_cpp(fb->pixel_format, 0);
> +	bpp = drm_format_plane_cpp(fb->format->format, 0);

Ditto.

>  	paddr = gem->paddr + fb->offsets[0];
>  	paddr += (state->src_x >> 16) * bpp;
>  	paddr += (state->src_y >> 16) * fb->pitches[0];
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 3af157a2d40c..4121d0c2aac8 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c

[snip]

> @@ -531,7 +531,7 @@ static int tegra_plane_atomic_check(struct drm_plane
> *plane, * error out if the user tries to display a framebuffer with such a
> * configuration.
>  	 */
> -	if (drm_format_num_planes(state->fb->pixel_format) > 2) {
> +	if (drm_format_num_planes(state->fb->format->format) > 2) {

state->fb->format->num_planes

>  		if (state->fb->pitches[2] != state->fb->pitches[1]) {
>  			DRM_ERROR("unsupported UV-plane configuration\n");
>  			return -EINVAL;
> @@ -576,7 +576,7 @@ static void tegra_plane_atomic_update(struct drm_plane
> *plane, window.format = state->format;
>  	window.swap = state->swap;
> 
> -	for (i = 0; i < drm_format_num_planes(fb->pixel_format); i++) {
> +	for (i = 0; i < drm_format_num_planes(fb->format->format); i++) {

Same here.

>  		struct tegra_bo *bo = tegra_fb_get_plane(fb, i);
> 
>  		window.base[i] = bo->paddr + fb->offsets[i];
> diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
> index 2a1bf92403b8..1ea5c39a4411 100644
> --- a/drivers/gpu/drm/tegra/fb.c
> +++ b/drivers/gpu/drm/tegra/fb.c
> @@ -32,7 +32,7 @@ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer
> *framebuffer, {
>  	struct tegra_fb *fb = to_tegra_fb(framebuffer);
> 
> -	if (index >= drm_format_num_planes(framebuffer->pixel_format))
> +	if (index >= drm_format_num_planes(framebuffer->format->format))

And here.

>  		return NULL;
> 
>  	return fb->planes[index];
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 822531ebd4b0..d00c59e115ff
> 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -79,7 +79,7 @@ static void set_scanout(struct drm_crtc *crtc, struct
> drm_framebuffer *fb)
> 
>  	start = gem->paddr + fb->offsets[0] +
>  		crtc->y * fb->pitches[0] +
> -		crtc->x * drm_format_plane_cpp(fb->pixel_format, 0);
> +		crtc->x * drm_format_plane_cpp(fb->format->format, 0);

I think you know what to do by now :-)

> 
>  	end = start + (crtc->mode.vdisplay * fb->pitches[0]);

[snip]

> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
> b/drivers/gpu/drm/tilcdc/tilcdc_plane.c index 8a6a50d74aff..5a303a81ac96
> 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
> @@ -69,7 +69,7 @@ static int tilcdc_plane_atomic_check(struct drm_plane
> *plane, }
> 
>  	pitch = crtc_state->mode.hdisplay *
> -		drm_format_plane_cpp(state->fb->pixel_format, 0);
> +		drm_format_plane_cpp(state->fb->format->format, 0);

Ditto.

>  	if (state->fb->pitches[0] != pitch) {
>  		dev_err(plane->dev->dev,
>  			"Invalid pitch: fb and crtc widths must be the same");
> @@ -77,7 +77,7 @@ static int tilcdc_plane_atomic_check(struct drm_plane
> *plane, }
> 
>  	if (state->fb && old_state->fb &&
> -	    state->fb->pixel_format != old_state->fb->pixel_format) {
> +	    state->fb->format->format != old_state->fb->format->format) {

state->fb->format != old_state->fb->format

>  		dev_dbg(plane->dev->dev,
>  			"%s(): pixel format change requires mode_change\n",
>  			__func__);
> diff --git a/drivers/gpu/drm/vc4/vc4_plane.c
> b/drivers/gpu/drm/vc4/vc4_plane.c index 881bf489478b..59be9e7c26de 100644
> --- a/drivers/gpu/drm/vc4/vc4_plane.c
> +++ b/drivers/gpu/drm/vc4/vc4_plane.c

[snip]

> @@ -369,7 +369,7 @@ static int vc4_plane_setup_clipping_and_scaling(struct
> drm_plane_state *state) */
>  	if (vc4_state->crtc_x < 0) {
>  		for (i = 0; i < num_planes; i++) {
> -			u32 cpp = drm_format_plane_cpp(fb->pixel_format, i);
> +			u32 cpp = drm_format_plane_cpp(fb->format->format, i);

fb->format->cpp[i]

>  			u32 subs = ((i == 0) ? 1 : h_subsample);
> 
>  			vc4_state->offsets[i] += (cpp *

[snip]

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list