Re: [PATCH v3 7/7] drm: Remove users of drm_format_num_planes
On Mon, May 20, 2019 at 01:20:45PM +0200, Paul Kocialkowski wrote: > Hi, > > On Thu 16 May 19, 12:31, Maxime Ripard wrote: > > drm_format_info_plane_cpp() basically just returns the cpp array content > > found in the drm_format_info structure. > > > > Since it's pretty trivial, let's remove the function and have the users use > > the array directly > > Reviewed-by: Paul Kocialkowski Applied all 7 patches to drm-misc-next, thanks! Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com signature.asc Description: PGP signature
Re: [PATCH v3 7/7] drm: Remove users of drm_format_num_planes
Hi, On Thu 16 May 19, 12:31, Maxime Ripard wrote: > drm_format_info_plane_cpp() basically just returns the cpp array content > found in the drm_format_info structure. > > Since it's pretty trivial, let's remove the function and have the users use > the array directly Reviewed-by: Paul Kocialkowski Cheers, Paul > Suggested-by: Ville Syrjälä > Signed-off-by: Maxime Ripard > > --- > > Changes from v2: > - new patch > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 2 +- > drivers/gpu/drm/arm/malidp_hw.c| 2 +- > drivers/gpu/drm/arm/malidp_planes.c| 2 +- > drivers/gpu/drm/drm_client.c | 2 +- > drivers/gpu/drm/drm_fb_helper.c| 2 +- > drivers/gpu/drm/drm_format_helper.c| 4 ++-- > drivers/gpu/drm/i915/intel_sprite.c| 2 +- > drivers/gpu/drm/mediatek/mtk_drm_fb.c | 2 +- > drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- > drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +- > drivers/gpu/drm/msm/msm_fb.c | 2 +- > drivers/gpu/drm/radeon/radeon_fb.c | 2 +- > drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- > drivers/gpu/drm/stm/ltdc.c | 2 +- > drivers/gpu/drm/tegra/fb.c | 2 +- > drivers/gpu/drm/zte/zx_plane.c | 2 +- > include/drm/drm_fourcc.h | 17 - > 17 files changed, 17 insertions(+), 34 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c > index 6edae6458be8..2e2869299a84 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c > @@ -133,7 +133,7 @@ static int amdgpufb_create_pinned_object(struct > amdgpu_fbdev *rfbdev, > u32 cpp; > > info = drm_get_format_info(adev->ddev, mode_cmd); > - cpp = drm_format_info_plane_cpp(info, 0); > + cpp = info->cpp[0]; > > /* need to align pitch with crtc limits */ > mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp, > diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c > index 1c9e869f4c52..53391c0f87eb 100644 > --- a/drivers/gpu/drm/arm/malidp_hw.c > +++ b/drivers/gpu/drm/arm/malidp_hw.c > @@ -383,7 +383,7 @@ static void malidp500_modeset(struct malidp_hw_device > *hwdev, struct videomode * > int malidp_format_get_bpp(u32 fmt) > { > const struct drm_format_info *info = drm_format_info(fmt); > - int bpp = drm_format_info_plane_cpp(info, 0) * 8; > + int bpp = info->cpp[0] * 8; > > if (bpp == 0) { > switch (fmt) { > diff --git a/drivers/gpu/drm/arm/malidp_planes.c > b/drivers/gpu/drm/arm/malidp_planes.c > index 361c02988375..07ceb4ee14e3 100644 > --- a/drivers/gpu/drm/arm/malidp_planes.c > +++ b/drivers/gpu/drm/arm/malidp_planes.c > @@ -227,7 +227,7 @@ bool malidp_format_mod_supported(struct drm_device *drm, > > if (modifier & AFBC_SPLIT) { > if (!info->is_yuv) { > - if (drm_format_info_plane_cpp(info, 0) <= 2) { > + if (info->cpp[0] <= 2) { > DRM_DEBUG_KMS("RGB formats <= 16bpp are not > supported with SPLIT\n"); > return false; > } > diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c > index 169d8eeaa662..5abcd83da6a6 100644 > --- a/drivers/gpu/drm/drm_client.c > +++ b/drivers/gpu/drm/drm_client.c > @@ -259,7 +259,7 @@ drm_client_buffer_create(struct drm_client_dev *client, > u32 width, u32 height, u > > dumb_args.width = width; > dumb_args.height = height; > - dumb_args.bpp = drm_format_info_plane_cpp(info, 0) * 8; > + dumb_args.bpp = info->cpp[0] * 8; > ret = drm_mode_create_dumb(dev, _args, client->file); > if (ret) > goto err_delete; > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 184f455c99ab..09605ed69f06 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -767,7 +767,7 @@ static void drm_fb_helper_dirty_blit_real(struct > drm_fb_helper *fb_helper, > struct drm_clip_rect *clip) > { > struct drm_framebuffer *fb = fb_helper->fb; > - unsigned int cpp = drm_format_info_plane_cpp(fb->format, 0); > + unsigned int cpp = fb->format->cpp[0]; > size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp; > void *src = fb_helper->fbdev->screen_buffer + offset; > void *dst = fb_helper->buffer->vaddr + offset; > diff --git a/drivers/gpu/drm/drm_format_helper.c > b/drivers/gpu/drm/drm_format_helper.c > index 8ad66aa1362a..0897cb9aeaff 100644 > --- a/drivers/gpu/drm/drm_format_helper.c > +++ b/drivers/gpu/drm/drm_format_helper.c > @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip, > void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, >
[PATCH v3 7/7] drm: Remove users of drm_format_num_planes
drm_format_info_plane_cpp() basically just returns the cpp array content found in the drm_format_info structure. Since it's pretty trivial, let's remove the function and have the users use the array directly Suggested-by: Ville Syrjälä Signed-off-by: Maxime Ripard --- Changes from v2: - new patch --- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 2 +- drivers/gpu/drm/arm/malidp_hw.c| 2 +- drivers/gpu/drm/arm/malidp_planes.c| 2 +- drivers/gpu/drm/drm_client.c | 2 +- drivers/gpu/drm/drm_fb_helper.c| 2 +- drivers/gpu/drm/drm_format_helper.c| 4 ++-- drivers/gpu/drm/i915/intel_sprite.c| 2 +- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +- drivers/gpu/drm/msm/msm_fb.c | 2 +- drivers/gpu/drm/radeon/radeon_fb.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +- drivers/gpu/drm/stm/ltdc.c | 2 +- drivers/gpu/drm/tegra/fb.c | 2 +- drivers/gpu/drm/zte/zx_plane.c | 2 +- include/drm/drm_fourcc.h | 17 - 17 files changed, 17 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c index 6edae6458be8..2e2869299a84 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c @@ -133,7 +133,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, u32 cpp; info = drm_get_format_info(adev->ddev, mode_cmd); - cpp = drm_format_info_plane_cpp(info, 0); + cpp = info->cpp[0]; /* need to align pitch with crtc limits */ mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp, diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c index 1c9e869f4c52..53391c0f87eb 100644 --- a/drivers/gpu/drm/arm/malidp_hw.c +++ b/drivers/gpu/drm/arm/malidp_hw.c @@ -383,7 +383,7 @@ static void malidp500_modeset(struct malidp_hw_device *hwdev, struct videomode * int malidp_format_get_bpp(u32 fmt) { const struct drm_format_info *info = drm_format_info(fmt); - int bpp = drm_format_info_plane_cpp(info, 0) * 8; + int bpp = info->cpp[0] * 8; if (bpp == 0) { switch (fmt) { diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 361c02988375..07ceb4ee14e3 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -227,7 +227,7 @@ bool malidp_format_mod_supported(struct drm_device *drm, if (modifier & AFBC_SPLIT) { if (!info->is_yuv) { - if (drm_format_info_plane_cpp(info, 0) <= 2) { + if (info->cpp[0] <= 2) { DRM_DEBUG_KMS("RGB formats <= 16bpp are not supported with SPLIT\n"); return false; } diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index 169d8eeaa662..5abcd83da6a6 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -259,7 +259,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u dumb_args.width = width; dumb_args.height = height; - dumb_args.bpp = drm_format_info_plane_cpp(info, 0) * 8; + dumb_args.bpp = info->cpp[0] * 8; ret = drm_mode_create_dumb(dev, _args, client->file); if (ret) goto err_delete; diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 184f455c99ab..09605ed69f06 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -767,7 +767,7 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper, struct drm_clip_rect *clip) { struct drm_framebuffer *fb = fb_helper->fb; - unsigned int cpp = drm_format_info_plane_cpp(fb->format, 0); + unsigned int cpp = fb->format->cpp[0]; size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp; void *src = fb_helper->fbdev->screen_buffer + offset; void *dst = fb_helper->buffer->vaddr + offset; diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 8ad66aa1362a..0897cb9aeaff 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -36,7 +36,7 @@ static unsigned int clip_offset(struct drm_rect *clip, void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip) { - unsigned int cpp = drm_format_info_plane_cpp(fb->format, 0); + unsigned int cpp = fb->format->cpp[0]; size_t len = (clip->x2 - clip->x1) * cpp; unsigned int y, lines = clip->y2 - clip->y1; @@