diff mbox series

drm/i915/overlay: Remove redundant drm_rect_visible() use

Message ID 20230324142533.6357-1-arthurgrillo@riseup.net (mailing list archive)
State New, archived
Headers show
Series drm/i915/overlay: Remove redundant drm_rect_visible() use | expand

Commit Message

Arthur Grillo March 24, 2023, 2:25 p.m. UTC
The drm_rect_intersect() already returns if the intersection is visible
or not, so the use of drm_rect_visible() is duplicate.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
---
 drivers/gpu/drm/i915/display/intel_overlay.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ville Syrjälä March 24, 2023, 9:55 p.m. UTC | #1
On Fri, Mar 24, 2023 at 11:25:33AM -0300, Arthur Grillo wrote:
> The drm_rect_intersect() already returns if the intersection is visible
> or not, so the use of drm_rect_visible() is duplicate.
> 
> Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
> ---
>  drivers/gpu/drm/i915/display/intel_overlay.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
> index c12bdca8da9b..444d88f418c5 100644
> --- a/drivers/gpu/drm/i915/display/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/display/intel_overlay.c
> @@ -966,9 +966,8 @@ static int check_overlay_dst(struct intel_overlay *overlay,
>  		      rec->dst_width, rec->dst_height);
>  
>  	clipped = req;
> -	drm_rect_intersect(&clipped, &crtc_state->pipe_src);
>  
> -	if (!drm_rect_visible(&clipped) ||
> +	if (!drm_rect_intersect(&clipped, &crtc_state->pipe_src) ||
>  	    !drm_rect_equals(&clipped, &req))

Hmm. I think I like the original a bit better because there is
no hard to spot dependency between the two sides of the ||.

I suppose another option would to to replace the || with
two separate if statements.

>  		return -EINVAL;
>  
> -- 
> 2.39.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
index c12bdca8da9b..444d88f418c5 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -966,9 +966,8 @@  static int check_overlay_dst(struct intel_overlay *overlay,
 		      rec->dst_width, rec->dst_height);
 
 	clipped = req;
-	drm_rect_intersect(&clipped, &crtc_state->pipe_src);
 
-	if (!drm_rect_visible(&clipped) ||
+	if (!drm_rect_intersect(&clipped, &crtc_state->pipe_src) ||
 	    !drm_rect_equals(&clipped, &req))
 		return -EINVAL;