From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 31/32] drm: Nuke fb->bits_per_pixel
Date: Thu, 17 Nov 2016 20:41:55 +0200 [thread overview]
Message-ID: <3091610.bWiP7N0xop@avalon> (raw)
In-Reply-To: <20161117183546.GC31595@intel.com>
Hi Ville,
On Thursday 17 Nov 2016 20:35:46 Ville Syrjälä wrote:
> On Thu, Nov 17, 2016 at 08:14:16PM +0200, Laurent Pinchart wrote:
> > On Thursday 17 Nov 2016 18:14:30 ville.syrjala@linux.intel.com wrote:
> >> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>
> >> Replace uses of fb->bits_per_pixel with fb->format->cpp[0]*8.
> >> Less duplicated information is a good thing.
> >>
> >> Note that I didn't put parens around the cpp*8 in the below cocci
> >> script, on account of not wanting spurious parens all over the place.
> >> Instead I did the unsafe way, and tried to look over the entire diff to
> >> spot if any dangerous expressions were produced. I didn't see any.
> >>
> >> There are some cases where previously the code did X*bpp/8, so the
> >> division happened after the multiplication. Those are now just X*cpp
> >> so the division effectively happens before the multiplication,
> >> but that is perfectly fine since bpp is always a multiple of 8.
> >
> > [snip]
> >
> >> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> ---
> >>
> >> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 2 +-
> >> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 2 +-
> >> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 2 +-
> >> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 2 +-
> >> drivers/gpu/drm/armada/armada_crtc.c | 4 ++--
> >> drivers/gpu/drm/armada/armada_fbdev.c | 2 +-
> >> drivers/gpu/drm/ast/ast_fb.c | 2 +-
> >> drivers/gpu/drm/ast/ast_mode.c | 9 +++++----
> >> drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +-
> >> drivers/gpu/drm/cirrus/cirrus_mode.c | 2 +-
> >> drivers/gpu/drm/drm_fb_helper.c | 8 ++++----
> >> drivers/gpu/drm/drm_framebuffer.c | 2 +-
> >> drivers/gpu/drm/drm_modeset_helper.c | 3 ---
> >> drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
> >> drivers/gpu/drm/exynos/exynos7_drm_decon.c | 6 +++---
> >> drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 ++--
> >> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
> >> drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++--
> >> drivers/gpu/drm/gma500/framebuffer.c | 2 +-
> >> drivers/gpu/drm/gma500/gma_display.c | 4 ++--
> >> drivers/gpu/drm/gma500/mdfld_intel_display.c | 6 +++---
> >> drivers/gpu/drm/gma500/oaktrail_crtc.c | 4 ++--
> >> drivers/gpu/drm/i915/i915_debugfs.c | 4 ++--
> >> drivers/gpu/drm/i915/intel_display.c | 11 ++++-------
> >> drivers/gpu/drm/i915/intel_fbdev.c | 6 +++---
> >> drivers/gpu/drm/mgag200/mgag200_fb.c | 2 +-
> >> drivers/gpu/drm/mgag200/mgag200_mode.c | 16 ++++++++--------
> >> drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++--
> >> drivers/gpu/drm/nouveau/nouveau_display.c | 2 +-
> >> drivers/gpu/drm/qxl/qxl_draw.c | 2 +-
> >> drivers/gpu/drm/radeon/atombios_crtc.c | 11 ++++++-----
> >> drivers/gpu/drm/radeon/r100.c | 4 ++--
> >> drivers/gpu/drm/radeon/radeon_display.c | 6 +++---
> >> drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 14 +++++++-------
> >> drivers/gpu/drm/tegra/dc.c | 2 +-
> >> drivers/gpu/drm/tegra/drm.c | 2 +-
> >> drivers/gpu/drm/udl/udl_fb.c | 2 +-
> >> drivers/gpu/drm/virtio/virtgpu_fb.c | 2 +-
> >> drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 6 +++---
> >> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 --
> >> drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 4 ++--
> >> drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 2 +-
> >> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 2 +-
> >> include/drm/drm_framebuffer.h | 7 -------
> >> 44 files changed, 89 insertions(+), 102 deletions(-)
> >
> > [snip]
> >
> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> >> b/drivers/gpu/drm/drm_fb_helper.c index 755e3b6e9710..bf5a06b7c0c1
> >> 100644
> >> --- a/drivers/gpu/drm/drm_fb_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >> @@ -1162,7 +1162,7 @@ static int setcolreg(struct drm_crtc *crtc, u16
> >> red, u16 green,
> >> !fb_helper->funcs->gamma_get))
> >>
> >> return -EINVAL;
> >>
> >> - WARN_ON(fb->bits_per_pixel != 8);
> >> + WARN_ON(fb->format->cpp[0] * 8 != 8);
> >
> > Maybe just WARN_ON(fb->format->cpp[0] != 1); ?
>
> I think I had a bit of cocci to do that... Yeah, it's there, and rerunning
> it does clean this up.
>
> spatch is rather finicky and does occasionally miss entire files when
> you run it in the -dir mode. But in this case it clearly do something to
> the file, so not sure why the cleanup part didn't get done.
>
> >> fb_helper->funcs->gamma_set(crtc, red, green, blue, regno);
> >
> > [snip]
> >
> >> diff --git a/drivers/gpu/drm/drm_modeset_helper.c
> >> b/drivers/gpu/drm/drm_modeset_helper.c index e5d19e5fc341..3c44409244dc
> >> 100644
> >> --- a/drivers/gpu/drm/drm_modeset_helper.c
> >> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> >> @@ -82,10 +82,7 @@ void drm_helper_mode_fill_fb_struct(struct drm_device
> >> *dev, DRM_DEBUG_KMS("non-RGB pixel format %s\n",
> >> drm_get_format_name(mode_cmd->pixel_format,
> >> &format_name));
> >> -
> >> - fb->bits_per_pixel = 0;
> >> } else {
> >> - fb->bits_per_pixel = info->cpp[0] * 8;
> >> }
> >
> > I think you can remove the whole check.
>
> Not sure I can tell the tool that. Probably easier to remove it by hand
> afterwards.
Fine with me, you can create a follow-up patch that manually fixes the left-
overs.
> >> fb->dev = dev;
> >
> > [snip]
> >
> >> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c
> >> b/drivers/gpu/drm/radeon/atombios_crtc.c index
> >> 05f4ebe31ce2..8eeffc5324b2
> >> 100644
> >> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> >> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> >> @@ -1277,7 +1277,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc
> >> *crtc,
> >> /* Calculate the macrotile mode index. */
> >> tile_split_bytes = 64 << tile_split;
> >> - tileb = 8 * 8 * target_fb->bits_per_pixel / 8;
> >> + tileb = (8 * 8) * target_fb->format->cpp[0];
> >
> > The parentheses are not needed.
>
> Added by cocci. I guess I can tell it to clean that up, but have to
> double check that it won't accidentally clean up something else too
> which needs extra parens.
You can also fix it manually in a subsequent patch.
> > With these fixed,
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> >> tileb = min(tile_split_bytes, tileb);
> >>
> >> for (index = 0; tileb > 64; index++)
> >
> > [snip]
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-11-17 18:41 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 16:13 [PATCH 00/32] drm: Deduplicate fb format information ville.syrjala
2016-11-17 16:14 ` [PATCH 01/32] drm/i915: Add local 'fb' variables ville.syrjala
2016-11-17 16:14 ` [PATCH 02/32] drm/radeon: " ville.syrjala
2016-11-17 17:21 ` Alex Deucher
2016-11-17 16:14 ` [PATCH 03/32] drm/radeon: Use DIV_ROUND_UP() ville.syrjala
2016-11-17 17:22 ` Alex Deucher
2016-11-17 16:14 ` [PATCH 04/32] drm/mgag200: Add local 'fb' variable ville.syrjala
2016-11-17 16:14 ` [PATCH 05/32] drm/ast: Add local 'fb' variables ville.syrjala
2016-11-17 16:14 ` [PATCH 06/32] drm/gma500: Add some " ville.syrjala
2016-11-17 16:14 ` [PATCH 07/32] drm/cirrus: " ville.syrjala
2016-11-17 16:14 ` [PATCH 08/32] drm/arcpgu: Add " ville.syrjala
2016-11-17 16:14 ` [PATCH 09/32] drm/arm: " ville.syrjala
2016-11-17 16:14 ` [PATCH 10/32] drm/nouveau: Fix crtc->primary->fb vs. drm_fb fail ville.syrjala
2016-11-17 16:14 ` [PATCH 11/32] drm/nouveau: Add local 'fb' variables ville.syrjala
2016-11-17 16:14 ` [PATCH 12/32] drm/vmwgfx: Populate fb->dev before drm_framebuffer_init() ville.syrjala
2016-11-17 16:14 ` [PATCH 13/32] drm: Pass 'dev' to drm_helper_mode_fill_fb_struct() ville.syrjala
2016-11-17 17:41 ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 14/32] drm/vmwgfx: Populate fb->pixel_format ville.syrjala
2016-11-17 17:52 ` Laurent Pinchart
2016-11-17 19:27 ` Ville Syrjälä
2016-11-17 16:14 ` [PATCH 15/32] drm/qxl: Call drm_helper_mode_fill_fb_struct() before drm_framebuffer_init() ville.syrjala
2016-11-17 16:14 ` [PATCH 16/32] drm/virtio: " ville.syrjala
2016-11-17 16:14 ` [PATCH 17/32] drm/i915: Set fb->dev early on for inherited fbs ville.syrjala
2016-11-17 16:14 ` [PATCH 18/32] drm: Populate fb->dev from drm_helper_mode_fill_fb_struct() ville.syrjala
2016-11-17 17:43 ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 19/32] drm: Store a pointer to drm_format_info under drm_framebuffer ville.syrjala
2016-11-17 17:57 ` Laurent Pinchart
2016-11-17 18:06 ` Ville Syrjälä
2016-11-17 18:13 ` Ville Syrjälä
2016-11-17 18:16 ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 20/32] drm/vmwgfx: Populate fb->format correctly ville.syrjala
2016-11-17 16:14 ` [PATCH 21/32] drm/i915: Populate fb->format early for inherited fbs ville.syrjala
2016-11-17 16:14 ` [PATCH 22/32] drm/atomic: Replace drm_format_num_planes() with fb->format->num_planes ville.syrjala
2016-11-17 17:58 ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 23/32] drm/fb_cma_helper: Replace drm_format_info() with fb->format ville.syrjala
2016-11-17 17:58 ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 24/32] drm/nouveau: Use fb->format rather than drm_format_info() ville.syrjala
2016-11-17 16:14 ` [PATCH 25/32] drm/i915: Store a pointer to the pixel format info for fbc ville.syrjala
2016-11-17 16:14 ` [PATCH 26/32] drm/i915: Replace drm_format_plane_cpp() with fb->format->cpp[] ville.syrjala
2016-11-17 16:14 ` [PATCH 27/32] drm/i915: Replace drm_format_num_planes() with fb->format->num_planes ville.syrjala
2016-11-17 16:14 ` [PATCH 28/32] drm: Add drm_framebuffer_plane_{width,height}() ville.syrjala
2016-11-17 16:14 ` [PATCH 29/32] drm/i915: Use drm_framebuffer_plane_{width, height}() where possible ville.syrjala
2016-11-17 16:14 ` [PATCH 30/32] drm: Nuke fb->depth ville.syrjala
2016-11-17 18:03 ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 31/32] drm: Nuke fb->bits_per_pixel ville.syrjala
2016-11-17 18:14 ` Laurent Pinchart
2016-11-17 18:35 ` Ville Syrjälä
2016-11-17 18:41 ` Laurent Pinchart [this message]
2016-11-17 19:18 ` [PATCH v2 " ville.syrjala
2016-11-17 16:14 ` [PATCH 32/32] drm: Nuke fb->pixel_format ville.syrjala
2016-11-17 17:37 ` Alex Deucher
2016-11-17 18:39 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3091610.bWiP7N0xop@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).