dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: ville.syrjala@linux.intel.com
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 34/37] drm: Replace 'format->format' comparisons to just 'format' comparisons
Date: Sat, 19 Nov 2016 04:56:56 +0200	[thread overview]
Message-ID: <1593371.tkbCZ4xNF7@avalon> (raw)
In-Reply-To: <1479498793-31021-35-git-send-email-ville.syrjala@linux.intel.com>

Hi Ville,

Thank you for the patch.

On Friday 18 Nov 2016 21:53:10 ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Rather than compare the format u32s of two format infos, we can direclty
> compare the format info pointers themselves. Noramlly all the ->format
> pointers all point to somwehere in the big array, so this is a valid
> way to test for equality.
> 
> Also drivers may want to point ->format at a private format info struct
> instead (eg. for special compressed formats with extra planes), so
> just comparing the pixel format values wouldn't necessaritly even work.
> But comparing the pointers will also take care of that case.
> 
> @@
> struct drm_framebuffer *a;
> struct drm_framebuffer *b;
> @@
> (
> - a->format->format != b->format->format
> + a->format != b->format
> 
> - a->format->format == b->format->format
> + a->format == b->format
> )
> 
> @@
> struct drm_plane_state *a;
> struct drm_plane_state *b;
> @@
> (
> - a->fb->format->format != b->fb->format->format
> + a->fb->format != b->fb->format
> 
> - a->fb->format->format == b->fb->format->format
> + a->fb->format == b->fb->format
> )
> 
> @@
> struct drm_crtc *crtc;
> struct drm_framebuffer *x;
> @@
> (
> - crtc->primary->fb->format->format != x->format->format
> + crtc->primary->fb->format != x->format
> 
> - x->format->format != crtc->primary->fb->format->format
> + x->format != crtc->primary->fb->format
> )
> 
> @@
> struct drm_mode_set *set;
> @@
> - set->fb->format->format != set->crtc->primary->fb->format->format
> + set->fb->format != set->crtc->primary->fb->format
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/armada/armada_crtc.c      | 2 +-
>  drivers/gpu/drm/drm_crtc_helper.c         | 3 +--
>  drivers/gpu/drm/drm_plane.c               | 2 +-
>  drivers/gpu/drm/i915/intel_display.c      | 2 +-
>  drivers/gpu/drm/imx/ipuv3-plane.c         | 6 +++---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_plane.c     | 2 +-
>  7 files changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/armada/armada_crtc.c
> b/drivers/gpu/drm/armada/armada_crtc.c index 52e139dc9e38..baebf3775f60
> 100644
> --- a/drivers/gpu/drm/armada/armada_crtc.c
> +++ b/drivers/gpu/drm/armada/armada_crtc.c
> @@ -996,7 +996,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc
> *crtc, int ret;
> 
>  	/* We don't support changing the pixel format */
> -	if (fb->format->format != crtc->primary->fb->format->format)
> +	if (fb->format != crtc->primary->fb->format)
>  		return -EINVAL;
> 
>  	work = kmalloc(sizeof(*work), GFP_KERNEL);
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> b/drivers/gpu/drm/drm_crtc_helper.c index 94bce0b462aa..9d007f5f9732 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -588,8 +588,7 @@ 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->format->format !=
> -			   set->crtc->primary->fb->format->format) {
> +		} else if (set->fb->format != set->crtc->primary->fb->format) 
{
>  			mode_changed = true;
>  		} else
>  			fb_changed = true;
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index ac1e06df7280..1d90520457d7 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -854,7 +854,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	if (ret)
>  		goto out;
> 
> -	if (crtc->primary->fb->format->format != fb->format->format) {
> +	if (crtc->primary->fb->format != fb->format) {
>  		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer
> format.\n"); ret = -EINVAL;
>  		goto out;
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c index f5f9f1422d69..7b7135be3b9e
> 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12148,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->format->format != crtc->primary->fb->format->format)
> +	if (fb->format != crtc->primary->fb->format)
>  		return -EINVAL;
> 
>  	/*
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c
> b/drivers/gpu/drm/imx/ipuv3-plane.c index 0b945f077344..8b5294d47cee 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -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->format->format != old_fb->format->format))
> +			      fb->format != old_fb->format))
>  		crtc_state->mode_changed = true;
> 
>  	eba = drm_plane_state_to_eba(state);
> @@ -315,7 +315,7 @@ static int ipu_plane_atomic_check(struct drm_plane
> *plane, if (vbo & 0x7 || vbo > 0xfffff8)
>  			return -EINVAL;
> 
> -		if (old_fb && (fb->format->format == old_fb->format->format)) 
{
> +		if (old_fb && (fb->format == old_fb->format)) {
>  			old_vbo = drm_plane_state_to_vbo(old_state);
>  			if (vbo != old_vbo)
>  				crtc_state->mode_changed = true;
> @@ -332,7 +332,7 @@ static int ipu_plane_atomic_check(struct drm_plane
> *plane, if (ubo & 0x7 || ubo > 0xfffff8)
>  			return -EINVAL;
> 
> -		if (old_fb && (fb->format->format == old_fb->format->format)) 
{
> +		if (old_fb && (fb->format == old_fb->format)) {
>  			old_ubo = drm_plane_state_to_ubo(old_state);
>  			if (ubo != old_ubo)
>  				crtc_state->mode_changed = true;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index
> b90e9e497260..6ecc6bc1f531 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->format->format != old_state->fb->format-
>format) {
> +		if (state->fb->format != old_state->fb->format) {
>  			DBG("%s: pixel_format change!", mdp5_plane->name);
>  			full_modeset = true;
>  		}
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
> b/drivers/gpu/drm/tilcdc/tilcdc_plane.c index 4b7519dfd1b9..ba0d66c0d8ac
> 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
> @@ -77,7 +77,7 @@ static int tilcdc_plane_atomic_check(struct drm_plane
> *plane, }
> 
>  	if (state->fb && old_state->fb &&
> -	    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__);

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-11-19  2:56 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 19:52 [PATCH v2 00/37] drm: Deduplicate fb format information (v2) ville.syrjala
2016-11-18 19:52 ` [PATCH 01/37] drm/i915: Add local 'fb' variables ville.syrjala
2016-11-30 14:44   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 02/37] drm/radeon: " ville.syrjala
2016-11-18 19:52 ` [PATCH 03/37] drm/radeon: Use DIV_ROUND_UP() ville.syrjala
2016-11-18 19:52 ` [PATCH 04/37] drm/mgag200: Add local 'fb' variable ville.syrjala
2016-11-30 14:45   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 05/37] drm/ast: Add local 'fb' variables ville.syrjala
2016-11-30 14:47   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 06/37] drm/gma500: Add some " ville.syrjala
2016-11-30 14:49   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 07/37] drm/cirrus: " ville.syrjala
2016-11-30 14:50   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 08/37] drm/arcpgu: Add " ville.syrjala
2016-11-21 15:30   ` Alexey Brodkin
2016-11-23 16:00   ` Alexey Brodkin
2016-11-18 19:52 ` [PATCH 09/37] drm/arm: " ville.syrjala
2016-11-18 20:30   ` Brian Starkey
2016-11-21 11:51   ` Liviu Dudau
2016-11-22 13:48     ` Ville Syrjälä
2016-11-22 13:57       ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 10/37] drm/nouveau: Fix crtc->primary->fb vs. drm_fb fail ville.syrjala
2016-11-30 14:56   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 11/37] drm/nouveau: Add local 'fb' variables ville.syrjala
2016-11-30 14:57   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 12/37] drm/vmwgfx: Populate fb->dev before drm_framebuffer_init() ville.syrjala
2016-11-21 17:10   ` Sinclair Yeh
2016-11-22 13:53   ` [PATCH v2 " ville.syrjala
2016-11-18 19:52 ` [PATCH 13/37] drm: Pass 'dev' to drm_helper_mode_fill_fb_struct() ville.syrjala
2016-12-14 20:48   ` [PATCH v2 " ville.syrjala
2016-11-18 19:52 ` [PATCH 14/37] drm/vmwgfx: Populate fb->pixel_format ville.syrjala
2016-11-21 17:10   ` Sinclair Yeh
2016-11-18 19:52 ` [PATCH 15/37] drm/qxl: Call drm_helper_mode_fill_fb_struct() before drm_framebuffer_init() ville.syrjala
2016-11-18 19:52 ` [PATCH 16/37] drm/virtio: " ville.syrjala
2016-11-30 15:32   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 17/37] drm/i915: Set fb->dev early on for inherited fbs ville.syrjala
2016-11-30 15:36   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH v2 18/37] drm: Populate fb->dev from drm_helper_mode_fill_fb_struct() ville.syrjala
2016-11-18 19:52 ` [PATCH v2 19/37] drm: Store a pointer to drm_format_info under drm_framebuffer ville.syrjala
2016-11-19  2:33   ` Laurent Pinchart
2016-11-18 19:52 ` [PATCH 20/37] drm/vmwgfx: Populate fb->format correctly ville.syrjala
2016-11-30 15:40   ` Daniel Vetter
2016-11-30 16:03     ` Ville Syrjälä
2016-11-30 16:09       ` Laurent Pinchart
2016-11-30 17:22         ` Daniel Vetter
2016-11-30 15:52   ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 21/37] drm/i915: Populate fb->format early for inherited fbs ville.syrjala
2016-11-30 15:42   ` Daniel Vetter
2016-11-30 15:57     ` Ville Syrjälä
2016-11-30 16:09     ` Daniel Vetter
2016-11-18 19:52 ` [PATCH 22/37] drm: Reject fbs w/o format info in drm_framebuffer_init() ville.syrjala
2016-11-19  2:36   ` Laurent Pinchart
2016-11-18 19:52 ` [PATCH 23/37] drm: Replace drm_format_num_planes() with fb->format->num_planes ville.syrjala
2016-11-19  2:41   ` Laurent Pinchart
2016-12-14 21:30   ` [PATCH v2 " ville.syrjala
2016-11-18 19:53 ` [PATCH 24/37] drm/i915: Eliminate the ugly 'fb?:' constructs from the ilk/skl wm code ville.syrjala
2016-11-30 15:51   ` [Intel-gfx] " Daniel Vetter
2016-11-30 15:59     ` Ville Syrjälä
2016-11-18 19:53 ` [PATCH 25/37] drm: Replace drm_format_plane_cpp() with fb->format->cpp[] ville.syrjala
2016-11-19  2:44   ` Laurent Pinchart
2016-12-14 21:30   ` [PATCH v2 " ville.syrjala
2016-11-18 19:53 ` [PATCH 26/37] drm/fb_cma_helper: Replace drm_format_info() with fb->format ville.syrjala
2016-11-18 19:53 ` [PATCH 27/37] drm/nouveau: Use fb->format rather than drm_format_info() ville.syrjala
2016-11-30 15:59   ` Daniel Vetter
2016-11-18 19:53 ` [PATCH 28/37] drm/i915: Store a pointer to the pixel format info for fbc ville.syrjala
2016-11-30 16:07   ` [Intel-gfx] " Daniel Vetter
2016-11-18 19:53 ` [PATCH 29/37] drm: Add drm_framebuffer_plane_{width,height}() ville.syrjala
2016-11-18 19:53 ` [PATCH 30/37] drm/i915: Use drm_framebuffer_plane_{width, height}() where possible ville.syrjala
2016-11-30 16:04   ` Daniel Vetter
2016-11-30 16:06   ` [Intel-gfx] " Daniel Vetter
2016-11-18 19:53 ` [PATCH 31/37] drm: Nuke fb->depth ville.syrjala
2016-11-30 16:01   ` Daniel Vetter
2016-12-14 21:31   ` [PATCH v2 " ville.syrjala
2016-11-18 19:53 ` [PATCH v2 32/37] drm: Nuke fb->bits_per_pixel ville.syrjala
2016-12-14 21:32   ` [PATCH v3 " ville.syrjala
2016-11-18 19:53 ` [PATCH v2 33/37] drm: Nuke fb->pixel_format ville.syrjala
2016-11-19  2:55   ` Laurent Pinchart
2016-12-14 21:32   ` [PATCH v3 " ville.syrjala
2016-11-18 19:53 ` [PATCH 34/37] drm: Replace 'format->format' comparisons to just 'format' comparisons ville.syrjala
2016-11-19  2:56   ` Laurent Pinchart [this message]
2016-11-18 19:53 ` [PATCH 35/37] drm: Eliminate the useless "non-RGB fb" debug message ville.syrjala
2016-11-19  2:57   ` Laurent Pinchart
2016-11-18 19:53 ` [PATCH 36/37] drm: Add mode_config .get_format_info() hook ville.syrjala
2016-11-20  8:13   ` Laurent Pinchart
2016-11-21 13:18     ` Ville Syrjälä
2016-11-21 13:23       ` Laurent Pinchart
2016-11-21 13:31         ` Ville Syrjälä
2016-11-21 13:42           ` Laurent Pinchart
2016-11-21 14:25             ` Ville Syrjälä
2016-11-22 13:41   ` [PATCH v2 " ville.syrjala
2016-11-18 19:53 ` [PATCH 37/37] drm/i915: Implement .get_format_info() hook for CCS ville.syrjala
2016-11-18 23:31   ` Ben Widawsky
2016-11-21 14:37     ` Ville Syrjälä
2016-11-21  8:42   ` [Intel-gfx] " Tvrtko Ursulin
2016-11-21 13:27     ` Ville Syrjälä
2016-11-21 14:04       ` Tvrtko Ursulin
2016-11-21 11:18 ` [PATCH v2 00/37] drm: Deduplicate fb format information (v2) Christian König
2016-12-14 21:37 ` Ville Syrjälä
2016-12-15 13:41   ` Ville Syrjälä

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=1593371.tkbCZ4xNF7@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).