diff mbox

[14/18] drm/i915: Extract intel_cursor_check_surface()

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

Commit Message

Ville Syrjälä July 19, 2018, 6:22 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Extract intel_cursor_check_surface() to better match the code layout
of the other plane types.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++++++++++--------------
 1 file changed, 29 insertions(+), 18 deletions(-)

Comments

Souza, Jose Aug. 24, 2018, 8:08 p.m. UTC | #1
On Thu, 2018-07-19 at 21:22 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Extract intel_cursor_check_surface() to better match the code layout
> of the other plane types.


Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++++++++++--
> ------------
>  1 file changed, 29 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index b0e39dcf2fb8..b39c941b4791 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9667,13 +9667,37 @@ static bool intel_cursor_size_ok(const struct
> intel_plane_state *plane_state)
>  		height > 0 && height <= config->cursor_height;
>  }
>  
> -static int intel_check_cursor(struct intel_crtc_state *crtc_state,
> -			      struct intel_plane_state *plane_state)
> +static int intel_cursor_check_surface(struct intel_plane_state
> *plane_state)
>  {
>  	const struct drm_framebuffer *fb = plane_state->base.fb;
>  	unsigned int rotation = plane_state->base.rotation;
>  	int src_x, src_y;
>  	u32 offset;
> +
> +	intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation);
> +	plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0,
> rotation);
> +
> +	src_x = plane_state->base.src_x >> 16;
> +	src_y = plane_state->base.src_y >> 16;
> +
> +	intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
> +	offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
> +						    plane_state, 0);
> +
> +	if (src_x != 0 || src_y != 0) {
> +		DRM_DEBUG_KMS("Arbitrary cursor panning not
> supported\n");
> +		return -EINVAL;
> +	}
> +
> +	plane_state->color_plane[0].offset = offset;
> +
> +	return 0;
> +}
> +
> +static int intel_check_cursor(struct intel_crtc_state *crtc_state,
> +			      struct intel_plane_state *plane_state)
> +{
> +	const struct drm_framebuffer *fb = plane_state->base.fb;
>  	int ret;
>  
>  	if (fb && fb->modifier != DRM_FORMAT_MOD_LINEAR) {
> @@ -9696,22 +9720,9 @@ static int intel_check_cursor(struct
> intel_crtc_state *crtc_state,
>  	if (ret)
>  		return ret;
>  
> -	intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation);
> -	plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0,
> rotation);
> -
> -	src_x = plane_state->base.src_x >> 16;
> -	src_y = plane_state->base.src_y >> 16;
> -
> -	intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
> -	offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
> -						    plane_state, 0);
> -
> -	if (src_x != 0 || src_y != 0) {
> -		DRM_DEBUG_KMS("Arbitrary cursor panning not
> supported\n");
> -		return -EINVAL;
> -	}
> -
> -	plane_state->color_plane[0].offset = offset;
> +	ret = intel_cursor_check_surface(plane_state);
> +	if (ret)
> +		return ret;
>  
>  	return 0;
>  }
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b0e39dcf2fb8..b39c941b4791 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9667,13 +9667,37 @@  static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state)
 		height > 0 && height <= config->cursor_height;
 }
 
-static int intel_check_cursor(struct intel_crtc_state *crtc_state,
-			      struct intel_plane_state *plane_state)
+static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
 {
 	const struct drm_framebuffer *fb = plane_state->base.fb;
 	unsigned int rotation = plane_state->base.rotation;
 	int src_x, src_y;
 	u32 offset;
+
+	intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation);
+	plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0, rotation);
+
+	src_x = plane_state->base.src_x >> 16;
+	src_y = plane_state->base.src_y >> 16;
+
+	intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
+	offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
+						    plane_state, 0);
+
+	if (src_x != 0 || src_y != 0) {
+		DRM_DEBUG_KMS("Arbitrary cursor panning not supported\n");
+		return -EINVAL;
+	}
+
+	plane_state->color_plane[0].offset = offset;
+
+	return 0;
+}
+
+static int intel_check_cursor(struct intel_crtc_state *crtc_state,
+			      struct intel_plane_state *plane_state)
+{
+	const struct drm_framebuffer *fb = plane_state->base.fb;
 	int ret;
 
 	if (fb && fb->modifier != DRM_FORMAT_MOD_LINEAR) {
@@ -9696,22 +9720,9 @@  static int intel_check_cursor(struct intel_crtc_state *crtc_state,
 	if (ret)
 		return ret;
 
-	intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation);
-	plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0, rotation);
-
-	src_x = plane_state->base.src_x >> 16;
-	src_y = plane_state->base.src_y >> 16;
-
-	intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
-	offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
-						    plane_state, 0);
-
-	if (src_x != 0 || src_y != 0) {
-		DRM_DEBUG_KMS("Arbitrary cursor panning not supported\n");
-		return -EINVAL;
-	}
-
-	plane_state->color_plane[0].offset = offset;
+	ret = intel_cursor_check_surface(plane_state);
+	if (ret)
+		return ret;
 
 	return 0;
 }