diff mbox

[1/3] drm: Extract __setplane_check()

Message ID 20180628135457.14647-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä June 28, 2018, 1:54 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Pull all the error checking out from __set_plane_internal() to a helper
function. We'll have another user of this soon.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_plane.c | 80 +++++++++++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 31 deletions(-)

Comments

Ville Syrjälä June 28, 2018, 3:56 p.m. UTC | #1
On Thu, Jun 28, 2018 at 03:09:30PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [1/3] drm: Extract __setplane_check()
> URL   : https://patchwork.freedesktop.org/series/45589/
> State : failure
> 
> == Summary ==
> 
> = CI Bug Log - changes from CI_DRM_4397 -> Patchwork_9473 =
> 
> == Summary - FAILURE ==
> 
>   Serious unknown changes coming with Patchwork_9473 absolutely need to be
>   verified manually.
>   
>   If you think the reported changes have nothing to do with the changes
>   introduced in Patchwork_9473, please notify your bug team to allow them
>   to document this new failure mode, which will reduce false positives in CI.
> 
>   External URL: https://patchwork.freedesktop.org/api/1.0/series/45589/revisions/1/mbox/
> 
> == Possible new issues ==
> 
>   === IGT changes ===
> 
>     ==== Possible regressions ====
> 
>     igt@gem_exec_suspend@basic-s4-devices:
>       fi-bxt-dsi:         PASS -> FAIL +2

hda fail:
<6>[  282.796748] systemd-udevd   D12664   283    243 0x80000104
<4>[  282.796795] Call Trace:
<4>[  282.796832]  ? __schedule+0x364/0xbf0
<4>[  282.796874]  schedule+0x2d/0x90
<4>[  282.796902]  __pm_runtime_barrier+0x9c/0x160
<4>[  282.796936]  ? wait_woken+0xa0/0xa0
<4>[  282.796969]  __pm_runtime_disable+0x84/0xe0
<4>[  282.797019]  snd_hda_codec_cleanup_for_unbind+0x203/0x210 [snd_hda_codec]
<4>[  282.797114]  hda_codec_driver_probe+0x47/0x100 [snd_hda_codec]>

>
> 
>     
> == Known issues ==
> 
>   Here are the changes found in Patchwork_9473 that come from known issues:
> 
>   === IGT changes ===
> 
>     ==== Issues hit ====
> 
>     igt@drv_module_reload@basic-reload:
>       fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)
> 
>     igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
>       fi-bxt-dsi:         PASS -> FAIL (fdo#103375) +3
> 
>     igt@prime_vgem@basic-fence-flip:
>       fi-ilk-650:         PASS -> FAIL (fdo#104008)
> 
>     
>   fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
>   fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
>   fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
> 
> 
> == Participating hosts (44 -> 39) ==
> 
>   Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 
> 
> 
> == Build changes ==
> 
>     * Linux: CI_DRM_4397 -> Patchwork_9473
> 
>   CI_DRM_4397: 7306233935b0e426454e8adcf09a8022faa03cbc @ git://anongit.freedesktop.org/gfx-ci/linux
>   IGT_4530: 0e98bf69f146eb72fe3a7c3b19a049b5786f0ca3 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
>   Patchwork_9473: aa9c2a3eaf0eb8ec2661d968f6cc23ea4b97855b @ git://anongit.freedesktop.org/gfx-ci/linux
> 
> 
> == Linux commits ==
> 
> aa9c2a3eaf0e drm: Skip __drm_mode_set_config_internal() on atomic drivers
> 1394e3cb028d drm: Introduce __setplane_atomic()
> d301e6d532be drm: Extract __setplane_check()
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9473/issues.html
Rodrigo Vivi June 28, 2018, 4:53 p.m. UTC | #2
On Thu, Jun 28, 2018 at 04:54:55PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Pull all the error checking out from __set_plane_internal() to a helper
> function. We'll have another user of this soon.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/drm_plane.c | 80 +++++++++++++++++++++++++++------------------
>  1 file changed, 49 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index df0b4ebbedbf..5c97a0131484 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -583,6 +583,52 @@ int drm_plane_check_pixel_format(struct drm_plane *plane,
>  	return 0;
>  }
>  
> +static int __setplane_check(struct drm_plane *plane,
> +			    struct drm_crtc *crtc,
> +			    struct drm_framebuffer *fb,
> +			    int32_t crtc_x, int32_t crtc_y,
> +			    uint32_t crtc_w, uint32_t crtc_h,
> +			    uint32_t src_x, uint32_t src_y,
> +			    uint32_t src_w, uint32_t src_h)
> +{
> +	int ret;
> +
> +	/* Check whether this plane is usable on this CRTC */
> +	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
> +		DRM_DEBUG_KMS("Invalid crtc for plane\n");
> +		return -EINVAL;
> +	}
> +
> +	/* Check whether this plane supports the fb pixel format. */
> +	ret = drm_plane_check_pixel_format(plane, fb->format->format,
> +					   fb->modifier);
> +	if (ret) {
> +		struct drm_format_name_buf format_name;
> +
> +		DRM_DEBUG_KMS("Invalid pixel format %s, modifier 0x%llx\n",
> +			      drm_get_format_name(fb->format->format,
> +						  &format_name),
> +			      fb->modifier);
> +		return ret;
> +	}
> +
> +	/* Give drivers some help against integer overflows */
> +	if (crtc_w > INT_MAX ||
> +	    crtc_x > INT_MAX - (int32_t) crtc_w ||
> +	    crtc_h > INT_MAX ||
> +	    crtc_y > INT_MAX - (int32_t) crtc_h) {
> +		DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
> +			      crtc_w, crtc_h, crtc_x, crtc_y);
> +		return -ERANGE;
> +	}
> +
> +	ret = drm_framebuffer_check_src_coords(src_x, src_y, src_w, src_h, fb);
> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}
> +
>  /*
>   * __setplane_internal - setplane handler for internal callers
>   *
> @@ -616,37 +662,9 @@ static int __setplane_internal(struct drm_plane *plane,
>  		goto out;
>  	}
>  
> -	/* Check whether this plane is usable on this CRTC */
> -	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
> -		DRM_DEBUG_KMS("Invalid crtc for plane\n");
> -		ret = -EINVAL;
> -		goto out;
> -	}
> -
> -	/* Check whether this plane supports the fb pixel format. */
> -	ret = drm_plane_check_pixel_format(plane, fb->format->format,
> -					   fb->modifier);
> -	if (ret) {
> -		struct drm_format_name_buf format_name;
> -		DRM_DEBUG_KMS("Invalid pixel format %s, modifier 0x%llx\n",
> -			      drm_get_format_name(fb->format->format,
> -						  &format_name),
> -			      fb->modifier);
> -		goto out;
> -	}
> -
> -	/* Give drivers some help against integer overflows */
> -	if (crtc_w > INT_MAX ||
> -	    crtc_x > INT_MAX - (int32_t) crtc_w ||
> -	    crtc_h > INT_MAX ||
> -	    crtc_y > INT_MAX - (int32_t) crtc_h) {
> -		DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
> -			      crtc_w, crtc_h, crtc_x, crtc_y);
> -		ret = -ERANGE;
> -		goto out;
> -	}
> -
> -	ret = drm_framebuffer_check_src_coords(src_x, src_y, src_w, src_h, fb);
> +	ret = __setplane_check(plane, crtc, fb,
> +			       crtc_x, crtc_y, crtc_w, crtc_h,
> +			       src_x, src_y, src_w, src_h);
>  	if (ret)
>  		goto out;
>  
> -- 
> 2.16.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index df0b4ebbedbf..5c97a0131484 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -583,6 +583,52 @@  int drm_plane_check_pixel_format(struct drm_plane *plane,
 	return 0;
 }
 
+static int __setplane_check(struct drm_plane *plane,
+			    struct drm_crtc *crtc,
+			    struct drm_framebuffer *fb,
+			    int32_t crtc_x, int32_t crtc_y,
+			    uint32_t crtc_w, uint32_t crtc_h,
+			    uint32_t src_x, uint32_t src_y,
+			    uint32_t src_w, uint32_t src_h)
+{
+	int ret;
+
+	/* Check whether this plane is usable on this CRTC */
+	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
+		DRM_DEBUG_KMS("Invalid crtc for plane\n");
+		return -EINVAL;
+	}
+
+	/* Check whether this plane supports the fb pixel format. */
+	ret = drm_plane_check_pixel_format(plane, fb->format->format,
+					   fb->modifier);
+	if (ret) {
+		struct drm_format_name_buf format_name;
+
+		DRM_DEBUG_KMS("Invalid pixel format %s, modifier 0x%llx\n",
+			      drm_get_format_name(fb->format->format,
+						  &format_name),
+			      fb->modifier);
+		return ret;
+	}
+
+	/* Give drivers some help against integer overflows */
+	if (crtc_w > INT_MAX ||
+	    crtc_x > INT_MAX - (int32_t) crtc_w ||
+	    crtc_h > INT_MAX ||
+	    crtc_y > INT_MAX - (int32_t) crtc_h) {
+		DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
+			      crtc_w, crtc_h, crtc_x, crtc_y);
+		return -ERANGE;
+	}
+
+	ret = drm_framebuffer_check_src_coords(src_x, src_y, src_w, src_h, fb);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /*
  * __setplane_internal - setplane handler for internal callers
  *
@@ -616,37 +662,9 @@  static int __setplane_internal(struct drm_plane *plane,
 		goto out;
 	}
 
-	/* Check whether this plane is usable on this CRTC */
-	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
-		DRM_DEBUG_KMS("Invalid crtc for plane\n");
-		ret = -EINVAL;
-		goto out;
-	}
-
-	/* Check whether this plane supports the fb pixel format. */
-	ret = drm_plane_check_pixel_format(plane, fb->format->format,
-					   fb->modifier);
-	if (ret) {
-		struct drm_format_name_buf format_name;
-		DRM_DEBUG_KMS("Invalid pixel format %s, modifier 0x%llx\n",
-			      drm_get_format_name(fb->format->format,
-						  &format_name),
-			      fb->modifier);
-		goto out;
-	}
-
-	/* Give drivers some help against integer overflows */
-	if (crtc_w > INT_MAX ||
-	    crtc_x > INT_MAX - (int32_t) crtc_w ||
-	    crtc_h > INT_MAX ||
-	    crtc_y > INT_MAX - (int32_t) crtc_h) {
-		DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
-			      crtc_w, crtc_h, crtc_x, crtc_y);
-		ret = -ERANGE;
-		goto out;
-	}
-
-	ret = drm_framebuffer_check_src_coords(src_x, src_y, src_w, src_h, fb);
+	ret = __setplane_check(plane, crtc, fb,
+			       crtc_x, crtc_y, crtc_w, crtc_h,
+			       src_x, src_y, src_w, src_h);
 	if (ret)
 		goto out;